I'm totally a newbie in terms of using Selenium ide or any automation testing tool. Now i'm stuck with this scenario: after testing elements 1 & 2 on top of the page, i need to scroll down a bit to test the elements just below 1 & 2. I've read something about using while and endWhile commands but you have to insert user-extension.js file first. [Link: http://www.software-testing-tutorials-automation.com/2013/09/how-to-generate-mouse-scrolling-event.html]. Problem is, it doesn't work. Any help guys? Thanks much!!
Asked
Active
Viewed 736 times
0
-
1What do you want to do exactly? You dont have to scroll 'manually', selenium should do it automatically if you want for example click element – kotoj Aug 22 '16 at 11:56
-
1Have a look here: http://stackoverflow.com/questions/13488359/how-to-automate-mouse-scrolling-event-in-selenium-ide This worked fine for me – Jsmith2800 Aug 22 '16 at 11:56
1 Answers
0
you can use javascript scroll down the page :
public void javaScriptToScrollDownPage(WebDriver driver, String coordinatevalue) throws KDTKeywordExecException {
try {
((JavascriptExecutor) driver).executeScript("scroll(0, " + coordinatevalue + ")");
} catch (Exception e) {
throw new KDTKeywordExecException("Not able to scroll down the page", e);
}
}
I have created as a function, can use this. You have to change the coordinate value ie how much you want to scroll down
Similarly for scrolling up:
public void javaScriptToScrollUpPage(WebDriver driver, String coordinatevalue) throws KDTKeywordExecException {
try {
((JavascriptExecutor) driver).executeScript("scroll(" + coordinatevalue + ",0)");
} catch (Exception e) {
throw new KDTKeywordExecException("Not able to scroll up the page", e);
}
}

SidJ
- 669
- 12
- 29