Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Selenium scrollToElement function not working as intended, test won't scroll

For my automation tests using selenium I have got a scrollToElemnet function:

const scrollToElement = async (selector) => {
    const element = await getElement(selector);
    await browser.executeScript('arguments[0].scrollIntoView(true);', element.getWebElement());
    await wait(1000);
};

the getEelementFunction is like so:

const getElement = async (selector) => {
    if (selector.includes('//')) {
        return element(by.xpath(`${selector}`));
    }
    return $$(`${selector}`).first();
};

the issue I'm having is that the scroll function doesn't actually do anything, there are no errors, but it just won't scroll.

What exactly am I doing wrong here? I'm at a loss really

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!