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

相关推荐
Tangcan-4 小时前
博客系统测试报告
功能测试·测试工具·postman
dexie_tech6 小时前
不惧高频挑战,电流传感器带宽升级
功能测试·科技·物联网·测试工具·能源
上海控安9 小时前
嵌入式软件安全解决之道-堆栈分析篇
测试工具·安全
zncxCOS10 小时前
【ETestDEV5教程30】ICD操作之信号组操作
python·测试工具·测试用例·集成测试
北岛三生10 小时前
MTK平台调试介绍(一)
图像处理·测试工具·测试用例
小白学大数据14 小时前
告别复杂 XPath:DeepSeek+Python 爬虫快速实践
开发语言·爬虫·python·selenium
汽车仪器仪表相关领域14 小时前
NHXJ-02汽车悬架检验台 实操型实战手册
人工智能·功能测试·测试工具·算法·安全·单元测试·可用性测试
k7Cx7e1 天前
Thinkphp6在Postman中接收不到Post参数的解决办法
测试工具·postman