scroll to element python selenium
from selenium.webdriver.common.action_chains import ActionChains element = driver.find_element_by_id("my-id") actions = ActionChains(driver) actions.move_to_element(element).perform()
scroll to element python selenium
from selenium.webdriver.common.action_chains import ActionChains element = driver.find_element_by_id("my-id") actions = ActionChains(driver) actions.move_to_element(element).perform()
selenium scroll to element python
# this scrolls untill the element is in the middle of the page element = driver.find_element_by_id("my-id") desired_y = (element.size['height'] / 2) + element.location['y'] current_y = (driver.execute_script('return window.innerHeight') / 2) + driver.execute_script('return window.pageYOffset') scroll_y_by = desired_y - current_y driver.execute_script("window.scrollBy(0, arguments[0]);", scroll_y_by)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us