分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

selenium 访问网页抛出ElementNotVisibleException异常

发布时间:2023-09-06 01:15责任编辑:苏小强关键词:selenium

问题描述:

在使用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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved