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.
-
1Does this answer your question? Page scroll up or down in Selenium WebDriver (Selenium 2) using javaNik– Nik2019-12-09 06:57:52 +00:00Commented Dec 9, 2019 at 6:57
-
I got the answer here at stackexchange sqa.stackexchange.com/questions/9655/…Dish– Dish2019-12-09 08:11:23 +00:00Commented Dec 9, 2019 at 8:11
Add a comment
|
1 Answer
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();