I've a page which has list of messages say for example 20 messages and I am able to view only 4 at a time then I need to scroll down. If I use normal scrolling methods, it will scroll the page but I want to scroll the messages.
Asked
Active
Viewed 96 times
0
-
1Does this answer your question? [Page scroll up or down in Selenium WebDriver (Selenium 2) using java](https://stackoverflow.com/questions/12293158/page-scroll-up-or-down-in-selenium-webdriver-selenium-2-using-java) – Nik Dec 09 '19 at 06:57
-
I got the answer here at stackexchange https://sqa.stackexchange.com/questions/9655/not-able-to-scroll-down-page-using-selenium-webdriver – Dish Dec 09 '19 at 08:11
1 Answers
1
I have a suggestion - if messages are open after double click you can click at the first once and then switch by sending Key.ARROW_DOWN. Something like that:
firstMessage.click();
int i = 0;
while (i < 20) {
firstMessage.sendKeys(Keys.ARROW_DOWN);
i++;
}
Or you can tru to use JS for scrolling by pixels:
new Actions(driver).moveToElement(webelement).clickAndHold().moveByOffset(0, valueOfPixelsToScroll).release(webelement).build().perform();

VSs
- 61
- 4