I'm trying to scroll inside form which is displayed in webpage. None of the scroll logic are working using Selenium. I tried to use Actions class as well as JavascriptExecutor, but scroll is not happening.
Steps:
- Navigate to https://www.ebay.com/b/Cell-Phones-Smartphones/9355/bn_320094
- Click on
See All
which should display a Form with left hand area scrollable
Code Written: Using Actions Class:-
WebElement element = waitUntilElementPresent(by);
Actions actions = new Actions(DriverManager.getDriver());
try{
actions.moveToElement(element).click();
actions = actions.sendKeys(Keys.PAGE_DOWN).click();
}catch (Exception e){
e.printStackTrace();
}
Using JavascriptExecutor:-
((JavascriptExecutor) DriverManager.getDriver()).executeScript("window.scrollBy(0,250)");
here is Python version: