How to scroll to a particular element on a web page with Python-UnitTest?

How to scroll to a particular element on a web page with Python-UnitTest?

Hi Brettm,

To scroll to a particular element on a web page with Python-UnitTest, you can try the sample code snippet below:

driver.get("https://www.lambdatest.com/") 

# Get the xpath of a certain word on webpage
element = driver.find_element_by_xpath('//*[@id="__next"]/div[1]/section[1]/div/div/div[1]/h1/text()[1]')

# Scroll to where the xpath is in
driver.execute_script("return arguments[0].scrollIntoView();", element)