利用python控制selenium進行一個網頁的登錄時報錯:
C:\Users\Desktop\selenium\chrome>python chrome.py
selenium.common.exceptions.WebDriverException: Message: unknown error: Element is not clickable at point (844, 555)
(Session info: chrome=66.0.3359.117)
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 10.0.16299 x86_64)
解決方法:
代碼由:
submitBtn=driver.find_element_by_id("loginButton1") //獲取登錄按鈕
submitBtn.click() //點擊按鈕
改變為:
submitBtn=driver.find_element_by_id("loginButton1") //獲取登錄按鈕
driver.execute_script("arguments[0].scrollIntoView()", submitBtn);
submitBtn.click() //點擊按鈕
網上查看時,有網有說可以在點擊之前加sleep,本人測試之后問題沒有得到解決
參考: https://blog.csdn.net/sinat_29673403/article/details/78459648
