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 小时前
软件测试系统流程和常见面试题
测试工具·面试
Hacker_Oldv3 小时前
Python技能进阶:探索Selenium库,实现网页自动化测试与爬虫
自动化测试·软件测试·爬虫·python·selenium·职场和发展
西游音月5 小时前
(5)pytest+Selenium自动化测试-元素定位之XPath定位
selenium·测试工具·pytest
L.Ru6 小时前
SIP抓包工具-sngrep的使用
测试工具·信息与通信·sngrep
卓码软件测评16 小时前
第三方软件测评机构:【Gatling与JMeter的架构对比:异步与非阻塞I/O模型如何实现更高并发】
测试工具·jmeter·架构·测试用例·负载均衡·压力测试
美团程序员17 小时前
一篇文章教你搞定:”xx 功能如何测试?“常见面试题型!
测试工具·面试·职场和发展·测试用例
软件测试雪儿1 天前
高频Postman软件测试面试题
测试工具·lua·postman
2501_915106321 天前
iOS App 测试工具全景分析,构建从开发调试到线上监控的多阶段工具链体系
android·测试工具·ios·小程序·uni-app·iphone·webview
小白学大数据1 天前
构建混合爬虫:何时使用Requests,何时切换至Selenium处理请求头?
爬虫·python·selenium·测试工具
Hacker_Fuchen1 天前
POST请求提交数据的三种方式及通过Postman实现
自动化测试·软件测试·测试工具·postman