How to scroll down within a DIV and not in the whole Page via Selenium JAVA
Asked
Active
Viewed 866 times
-5
-
1[This](https://stackoverflow.com/questions/18635798/how-do-i-scroll-down-vertically-in-a-specific-div-in-a-web-page) might help you. – peter pawar May 30 '17 at 05:06
-
2Try this https://stackoverflow.com/questions/27189182/how-to-scroll-a-specific-div-using-selenium-webdriver-with-java – Jay Smith May 30 '17 at 05:08
-
1@akshaygoyal Can you consider showing us your work please? Thanks – undetected Selenium May 30 '17 at 05:25
-
Please put some effort first to find the solution of your problem. still not getting then explain the specific problem and add your question with proper description and effort you did – Trimantra Software Solution May 30 '17 at 05:54
1 Answers
3
Use JavascriptExecutor
JavascriptExecutor js=(JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoView(true);", element);
But you need to explore various conditions under executeScript method.
Or,
You can use Action class if you require to move other element, org.openqa.selenium.interactions.Actions
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.perform();

Sanjay Bhimani
- 1,593
- 1
- 15
- 29
-
This code scroll down to the particular element. Here, OP wants to scroll within an element. – Chanda Korat May 30 '17 at 05:19