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

相关推荐
shughui36 分钟前
Fiddler下载、安装、使用、汉化,详细图文教程(2026附安装包)
前端·测试工具·fiddler
若惜6 小时前
selenium自动化测试web自动化测试 框架封装Pom
前端·python·selenium
2501_915921438 小时前
常用iOS性能测试工具大全及使用指南
android·测试工具·ios·小程序·uni-app·cocoa·iphone
半个俗人9 小时前
3.postman全局变量和环境变量
测试工具·postman
海特伟业10 小时前
蒸汽阀门内漏检测仪在线免拆卸精微温度检测蒸汽阀门疏水器内部泄漏-有效助力蒸汽管网安全运行措施解析
测试工具
为你奋斗!1 天前
图形化界面工具 - webUI使用Page Assist 插件
测试工具
CN.LG1 天前
抓包工具 Wireshark 是什么?
网络·测试工具·wireshark
星空1 天前
postman复习
测试工具·postman
念越1 天前
自动化测试入门指南:Selenium环境搭建+第一个实战案例
自动化测试·selenium·测试工具·蓝桥杯