python控制selenium点击登录按钮时报错 unknown error: Element is not clickable at point

 

利用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

 
 
posted @ 2018-04-25 14:06  qian@@jing  阅读(2287)  评论(0编辑  收藏  举报