1

I am having a problem testing a website on which most elements are loading as you go in your view. Basically whenever i scroll to an element by ID and i attemt to click it it has already moved or my view got scrolled up or down. How can I easily make this bulletproof?

This only occurs on chromedriver, on geckodriver there is no problem with loading.

Used code:

        WebElement scrollTest = driver.findElement(By.id("testId"));
        ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();", scrollTest);
EdoTest
  • 11
  • 1
  • This might be of help [SO Link](https://stackoverflow.com/questions/3401343/scroll-element-into-view-with-selenium). You may alternately use `move to element` – Anand Gautam Feb 16 '22 at 07:57
  • The thing is that when I scroll to the element, it will trigger new elements to load as they are in view which will then scroll the element out of the view and I am unable to click it any longer, i would need a double or even a triple validation for this, is there any other way around? – EdoTest Feb 16 '22 at 08:27
  • Is it possible for you to share the website link here? – Anand Gautam Feb 16 '22 at 08:40
  • I don't see this id `"testId` in the DOM. What is the element you are looking for? – Anand Gautam Feb 16 '22 at 09:56

0 Answers0