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

相关推荐
工会主席-阿冰3 分钟前
使用pytest-selenium插件,ui自动化示例
selenium·pytest
Rover.x30 分钟前
Wireshark抓包分析工具
网络·测试工具·wireshark
湫一刀15 小时前
WireShark下载说明
网络·测试工具·wireshark
拽着尾巴的鱼儿17 小时前
工具:Postman-CRUL 接口调用
测试工具·postman
love is sour18 小时前
深入浅出 jmap:Java 内存分析的“显微镜“
java·开发语言·测试工具·性能优化
少云清20 小时前
【接口测试】6_Postman _Postman关联
测试工具·postman
喝养乐多长不高20 小时前
测试基础篇
测试工具·测试·测试基础
卓码软件测评21 小时前
第三方APP软件测试机构:【Gatling如何测试移动应用后端API移动网络特性和用户行为模拟】
网络·测试工具·单元测试·测试用例
我会一直在的21 小时前
Fiddler基础使用介绍
前端·测试工具·fiddler
认真的小羽❅1 天前
Python Selenium 超详细新手教程:从零开始掌握浏览器自动化
selenium·测试工具·自动化