Sometimes we need to perform action on an element which is not present in the viewable area of the page. We need to scroll down to the page in order to reach that element.
While working with Actions class to scroll to view, we have to use the moveToElement() method. This method shall perform mouse movement till the middle of the element.
Code Implementation with Actions.
from selenium.webdriver import ActionChains from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\\chromedriver.exe") driver.get("https://www.tutorialspoint.com/index.htm") # identify element I=driver.find_element_by_xpath("//*[text()='About Us']") # action object creation to scroll a = ActionChains(driver) a.move_to_element(l).perform()