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

相关推荐
^毛小兔^16 分钟前
Postman实现jwt发送请求
测试工具·postman
程序员小远17 分钟前
Postman接口测试: Postman环境变量&全局变量设置,多接口顺序执行详解
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
天才测试猿18 分钟前
Postman使用方法
自动化测试·软件测试·测试工具·职场和发展·测试用例·接口测试·postman
程序员三藏20 分钟前
Postman定义公共函数
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
安冬的码畜日常24 分钟前
【JUnit实战3_26】第十五章:表现层测试(下)—— Selenium 在网页测试中的用法
selenium·测试工具·junit·gui测试·junit5·表现层测试
程序员三藏14 小时前
Postman持久化保存/设置断言详解
自动化测试·软件测试·python·测试工具·职场和发展·接口测试·postman
测试199817 小时前
如何写出一个完整的测试用例?
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
我的xiaodoujiao1 天前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 22--数据驱动--参数化处理 Json 文件
python·学习·测试工具·pytest
安冬的码畜日常1 天前
【JUnit实战3_23】 第十四章:JUnit 5 扩展模型(Extension API)实战(上)
测试工具·junit·单元测试·jdbc·h2·extension模型·junit5扩展
景彡先生1 天前
Python Selenium详解:从入门到实战,Web自动化的“瑞士军刀”
前端·python·selenium