SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.76k stars 8.02k forks source link

[🐛 Bug]: selenium.webdriver.Edge() -> #14199

Closed SongzqInChina closed 6 days ago

SongzqInChina commented 6 days ago

What happened?

调用时发生错误: Traceback (most recent call last): File "D:\codes\cx\tests-chrome-driver.py", line 7, in x = webdriver.Edge(edgedriver_path, log_path="edgedriver.log") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\selenium\webdriver\edge\webdriver.py", line 61, in init RemoteWebDriver.init( File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute response = self.command_executor.execute(driver_command, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 378, in execute return self._request(command_info[0], url, body=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 407, in _request resp = http.request(method, url, body=body, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3_request_methods.py", line 118, in request return self.request_encode_body( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3_request_methods.py", line 217, in request_encode_body return self.urlopen(method, url, extra_kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\poolmanager.py", line 434, in urlopen conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\poolmanager.py", line 305, in connection_from_host return self.connection_from_context(request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\poolmanager.py", line 330, in connection_from_context return self.connection_from_pool_key(pool_key, request_context=request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\poolmanager.py", line 353, in connection_from_pool_key pool = self._new_pool(scheme, host, port, request_context=request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\poolmanager.py", line 267, in _new_pool return pool_cls(host, port, request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\connectionpool.py", line 196, in init timeout = Timeout.from_float(timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\util\timeout.py", line 190, in from_float t = Timeout(read=timeout, connect=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\util\timeout.py", line 119, in init self._connect = self._validate_timeout(connect, "connect") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ProgramData\anaconda3\envs\Python-test\Lib\site-packages\urllib3\util\timeout.py", line 156, in _validate_timeout raise ValueError( ValueError: Timeout value connect was <object object at 0x000002482E834540>, but it must be an int, float or None.

How can we reproduce the issue?

import os
import selenium
import logging
from selenium import webdriver

logging.getLogger("selenium").setLevel("DEBUG")
logging.basicConfig(level=logging.DEBUG)

edgedriver_path = r"G:\webdrivers\edgedriver\msedgedriver.exe"
# 初始化Edge浏览器实例
x = webdriver.Edge(edgedriver_path)
x.get("http://www.baidu.com")
input("Press Enter to exit...")
x.quit()

Relevant log output

错误发生时只截取到一条日志:

DEBUG:selenium.webdriver.remote.remote_connection:POST http://localhost:63491/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "MicrosoftEdge", "platformName": "windows"}}, "desiredCapabilities": {"browserName": "MicrosoftEdge", "version": "", "platform": "WINDOWS"}}

Operating System

Windows10 22H2

Selenium version

Python 3.11.9

What are the browser(s) and version(s) where you see this issue?

Microsoft Edge 126.0.2592.68 (正式版本) (64 位)

What are the browser driver(s) and version(s) where you see this issue?

Edgedriver 126.0.2592.68

Are you using Selenium Grid?

No response

github-actions[bot] commented 6 days ago

@SongzqInChina, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

diemol commented 6 days ago

Please update to the latest Selenium https://www.selenium.dev/downloads/ and create a new issue if the problem persists.