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:
See All
which should display a Form with left hand area scrollableCode 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:
driver.maximize_window()
driver.get("https://www.ebay.com/b/Cell-Phones-Smartphones/9355/bn_320094")
driver.find_element(
By.CSS_SELECTOR, "div#mainContent>div:nth-of-type(1) >section:nth-of-type(1) div.b-carousel__seeall>button").click()
wait = WebDriverWait(driver, 30)
wait.until(EC.visibility_of_element_located(
(By.CSS_SELECTOR, "div.x-overlay__body.dialog__body")))
driver.execute_script("arguments[0].scrollIntoView()", driver.find_element(
By.CSS_SELECTOR, "div[data-aspecttitle='location']"))