1

This question already has an answer here:

No matter how many javscript executor lines I use or how many times I change the scrolling positions to different numbers, Selenium WebDriver 3 always takes me to the same place on the list that is doing parallax scrolling.

It scrolls to row 70 of the list but I want to go to row 65. I tried various ways, but it does not work. This same code was working with selenium webdriver 2 before. The element is hidden until you scroll to it through the list so I can't use scroll into view.

Can someone please advise how I can scroll to the element so I can click on it? Thanks.

((JavascriptExecutor)driver).executeScript("scroll(0,1000)");
((JavascriptExecutor)driver).executeScript("scroll(1000,2000)");
((JavascriptExecutor)driver).executeScript("scroll(2000,1500)");

 I also tried this and it didn't work either.
 javascript.executeScript("window.scrollBy(0,600)", "");

marked as duplicate by Bharat Mane, IAmMilinPatel, NarendraC, ECiurleo, kirbycope Mar 24 '17 at 17:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Possible there are scroll bar which is not browser default scroll bar.Please share scroll area screenshot and code so we can get more idea. – Sagar007 Feb 22 '17 at 4:58
  • Use possible answers from this question; How to Scroll web page in Selenium. sqa.stackexchange.com/questions/18796/… – Bharat Mane Mar 24 '17 at 5:13
0

Try this to scroll to the element.

JavascriptExecutor jse = (JavascriptExecutor)driver;

WebElement element = driver.findElement(By.id(id_name));

jse.executeScript("arguments[0].scrollIntoView(true);", element);

Not the answer you're looking for? Browse other questions tagged or ask your own question.