python+Selenium之操作滾動條


當我們做測試的時候,如果頁面過長,就會定位元素失敗,這時可以使用move_to_element方法跳到該元素的位置再操作:

from selenium.webdriver.common.action_chains import ActionChains

target = driver.find_element(By.XPATH, "//i[@class='EPLI_Ext']")
driver.execute_script("arguments[0].scrollIntoView();", target)
ActionChains(driver).move_to_element(driver.find_element(By.XPATH, "//i[@class='EPLI_Ext']")).click().perform()

 

https://www.cnblogs.com/yoyoketang/p/6128655.html

https://blog.csdn.net/dzh0622/article/details/52066640


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM