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

相关推荐
1***s6322 小时前
后端API测试工具对比,Postman与Insomnia
测试工具·postman
程序员三藏4 小时前
Web自动化测试详细流程和步骤
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
卖个几把萌5 小时前
【07】JMeter 将Swagger接口直接转为JMeter脚本
测试工具·jmeter
Pixeler6 小时前
Selenium 八大定位方法
selenium·测试工具
我的xiaodoujiao19 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 25--数据驱动--参数化处理 Excel 文件 2
前端·python·学习·测试工具·ui·pytest
汪汪队立大功12319 小时前
selenium中执行javascript,是否等价于在浏览器console位置执行
javascript·selenium·测试工具
kewu897120 小时前
Postman 完全入门教程
测试工具·lua·postman
卖个几把萌1 天前
【06】JMeter获取接口返回变量,传给下一个接口(正则表达式提取、json提取)
测试工具·jmeter
程序员小远2 天前
软件测试之bug分析定位技巧
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·bug