我正在嘗試使用滾動瀏覽本地 div 元素driver.find_element_by_xpath(element).send_keys(Keys.PAGE_DOWN)
問題是它element不是一個接受鍵輸入的元素,所以代碼會拋出一個selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
我寧愿使用 pyautogui 來模擬滑鼠和鍵盤功能
pyautogui.moveTo(663,680)
pyautogui.click(663,680)
pyautogui.scroll(-200)
time.sleep(2)
但我想將代碼保留在瀏覽器中
任何解決方案?
uj5u.com熱心網友回復:
driver.execute_script("arguments[0].scrollIntoView(true)", element)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/475495.html
上一篇:Python&Selenium:ElementClickInterceptedException:訊息:元素點擊被攔截錯誤
下一篇:Vuejs顯示運行余額
