首页 > Web开发 > 详细

selenium 访问网页抛出ElementNotVisibleException异常

时间:2017-10-07 13:40:45      阅读:586      评论:0      收藏:0      [点我收藏+]

问题描述:

在使用selenium时遇到如下异常导致程序终止:

selenium.common.exceptions.ElementNotVisibleException: Message: {"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"81","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:55400","User-Agent":"Python http auth"},"httpVersion":"1.1","method":"POST","post":"{\"id\": \":wdc:1507345910060\", \"sessionId\": \"416c7180-ab0d-11e7-b13e-8162184dcb19\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/416c7180-ab0d-11e7-b13e-8162184dcb19/element/:wdc:1507345910060/click"}}
Screenshot: available via screen

解决办法:

在启动对应浏览器驱动后,添加如下所示深紫色所示内容。(Note:该条语句用于设置窗口显示尺寸规格,最好设置为您当前pc的电脑分辨率

brower = webdriver.Chrome()

brower.set_window_size(1920, 1080)

selenium 访问网页抛出ElementNotVisibleException异常

原文:http://www.cnblogs.com/crawer-1/p/7634372.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!