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