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

相关推荐
胜天半月子28 分钟前
接口测试 | Postman的安装和测试使用
测试工具·接口测试·postman
Bellafu6663 小时前
selenium 常用xpath写法
前端·selenium·测试工具
Bellafu6666 小时前
selenium常用的等待有哪些?
python·selenium·测试工具
Bellafu6668 小时前
selenium定位元素失败,常见错误有哪些?
selenium·测试工具
傻啦嘿哟14 小时前
用Selenium模拟登录淘宝并采集商品信息:从基础到实战
selenium·测试工具
起个破名想半天了17 小时前
五秒盾解决方案之Selenium
selenium·cloudflare·反爬
robinspada17 小时前
用mitmproxy替代selenium-wire
selenium·测试工具·mitmproxy·selenium-wire
我的xiaodoujiao17 小时前
从 0 到 1 搭建完整 Python 语言 Web UI自动化测试学习系列 17--测试框架Pytest基础 1--介绍使用
python·学习·测试工具·pytest
Bellafu66617 小时前
selenium的css定位方式有哪些
css·selenium·tensorflow
Bellafu66617 小时前
selenium对每种前端控件的操作,python举例
前端·python·selenium