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

相关推荐
旷世奇才李先生6 小时前
Selenium 安装使用教程
selenium·测试工具
巴里巴气19 小时前
对selenium进行浏览器和驱动进行配置Windows | Linux
selenium·测试工具
q567315231 天前
Java Selenium反爬虫技术方案
java·爬虫·selenium
有趣的我2 天前
wireshark介绍和使用
网络·测试工具·wireshark
草履虫建模2 天前
Postman - API 调试与开发工具 - 标准使用流程
java·测试工具·spring·json·测试用例·postman·集成学习
龙潜月七2 天前
Selenium 自动化测试中跳过机器人验证的完整指南:能用
python·selenium·机器人
AIZHINAN2 天前
如何评价 selenium 自动化测试框架搭建?
selenium·测试工具
WIN赢11 天前
PostMan使用
测试工具·lua·postman
百里图书12 天前
颠覆传统接口测试!用 Streamlit + SQLite + GPT 打造可视化自动化平台
自动化测试·测试开发·接口自动化测试·测试工具·接口测试·测试平台·python编程
笑口常开的小丸子12 天前
Selenium等待机制详解:从原理到实战应用
selenium