how to scroll to an element in selenium code example

Example 1: 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()

Example 2: selenium scroll element into view inside overflow python

element = d.find_element_by_xpath("//span[.='Most popular']")
d.execute_script("return arguments[0].scrollIntoView();", element)

Example 3: selenium scroll to element c#

var element = driver.FindElement(By.id("element-id"));
Actions actions = new Actions(driver);
actions.MoveToElement(element);
actions.Perform();