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

相关推荐
JZMSYYQ4 小时前
磁光克尔效应在量子计算中的应用
功能测试·测试工具·制造
逸雨清风1 天前
Chrome更新到136以后selenium等自动化浏览器失效
selenium·自动化
小白学大数据1 天前
Python+Selenium爬虫:豆瓣登录反反爬策略解析
分布式·爬虫·python·selenium
小冯的编程学习之路1 天前
【软件测试】:推荐一些接口与自动化测试学习练习网站(API测试与自动化学习全攻略)
c++·selenium·测试工具·jmeter·自动化·测试用例·postman
Ten peaches2 天前
Selenium-Java版(操作元素)
java·selenium·测试工具·html
傻小胖2 天前
三种常见接口测试工具(Apipost、Apifox、Postman)
测试工具·postman
辛普森Mmmm2 天前
Postman接口测试
测试工具·postman
程序员三藏2 天前
软件测试之功能测试详解
自动化测试·软件测试·python·功能测试·测试工具·职场和发展·测试用例
Looooking2 天前
Python 之 selenium 打开浏览器指定端口进行接续操作
python·selenium
头疼的程序员2 天前
allure生成测试报告(搭配Pytest、allure-pytest)
测试工具·pytest