How to deal with is not a window scroll bar selenium

1. If you look at a window scroll bar, how

js="window.scrollTo(100,450);"

driver.execute_script(js) 

2. If it is not window scroll bar, scroll bar is embedded:

We can first locate an element, which is the need to drag the scroll bar, drag the scroll bar to the position of the element:

target = driver.find_element_by_id("id_keypair") 
driver.execute_script("arguments[0].scrollIntoView();", target)

Guess you like

Origin www.cnblogs.com/erinsuo/p/11265637.html