selenium 4 raises exception without useful message

selenium 4 raises exception

example code:

python 复制代码
driver = webdriver.Chrome()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

issue log:

复制代码
Traceback (most recent call last):
...
File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message:

investigation:

Run below code:

python 复制代码
from selenium import webdriver
import logging

logging.basicConfig(level=logging.DEBUG)

def main() -> int:
    browser = webdriver.Firefox()
    browser.get('http://selenium.dev/')
    return 0
    
if __name__ == "__main__":
    raise SystemExit(main())

From the output, it shows something related to proxy.

solution:

  • downgrade to selenium 3.14.1
  • remove proxy in environment variable

github issue

相关推荐
梦想不只是梦与想10 小时前
鸿蒙 测试工具:DevEco Testing(一)
测试工具·harmonyos·testing
ClouGence12 小时前
Selenium 写不动了?这个工具录一次就能跑 Web 自动化
前端·selenium·测试
我的xiaodoujiao1 天前
快速学习Python基础知识详细图文教程17--类型注解和断点调试
开发语言·python·学习·测试工具
泽众云测试2 天前
泽众软件与日联科技达成合作,TestOne自动化测试平台助力搭建工业检测装备数字化品控防线
功能测试·测试工具·自动化
xy34532 天前
SQLMap 核心语法与使用指南(三)
测试工具·渗透测试·sqlmap
我的xiaodoujiao2 天前
快速学习Python基础知识详细图文教程18--多线程
开发语言·python·学习·测试工具
匠测AI说2 天前
Selenium 工作原理深度解析:从架构到实践
selenium·测试工具·架构
程序员杰哥2 天前
依赖于第三方接口时,如何进行测试?
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
liwulin05063 天前
【PYTHON】使用Selenium + ChromeDriver以及XPATH语法
开发语言·python·selenium
雾沉川3 天前
Wireshark v4.4.7.0 网络抓包工具安装与实操技术教程
网络·测试工具·wireshark