You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but when I execute it on Linux as below, it failed.
fromseleniumimportwebdriverfromselenium.webdriver.chrome.serviceimportServiceurl="https://vip.stock.finance.sina.com.cn/mkt/#stock_hs_up"option=webdriver.ChromeOptions()
option.add_argument('headless')
# here I need to set the correct binary path of chrome driver. It is a little bit different from code on Windows.service=Service(executable_path='./chromedriver-linux64/chromedriver')
driver=webdriver.Chrome(options=option, service=service)
# driver = webdriver.Chrome()driver.get(url)
width=driver.execute_script("return document.documentElement.scrollWidth")
height=driver.execute_script("return document.documentElement.scrollHeight")
driver.set_window_size(width, height)
driver.get_screenshot_as_file("webpage.png")
Chrome version: Google Chrome 134.0.6998.88
selenium version: 4.29.0
the network is OK
I failed to get the result.
Traceback (most recent call last):
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 534, in _make_request
response = conn.getresponse()
^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connection.py", line 516, in getresponse
httplib_response = super().getresponse()
^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/http/client.py", line 1395, in getresponse
response.begin()
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/http/client.py", line 325, in begin
version, status, reason = self._read_status()
^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/http/client.py", line 286, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/socket.py", line 718, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cuichengyu/quantrading/test.py", line 17, in <module>
driver.get(url)
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 454, in get
self.execute(Command.GET, {"url": url})
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 427, in execute
response = self.command_executor.execute(driver_command, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 404, in execute
return self._request(command_info[0], url, body=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 428, in _request
response = self._conn.request(method, url, body=body, headers=headers, timeout=self._client_config.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/_request_methods.py", line 143, in request
return self.request_encode_body(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/_request_methods.py", line 278, in request_encode_body
return self.urlopen(method, url, **extra_kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/poolmanager.py", line 443, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 841, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/util/retry.py", line 474, in increment
raise reraise(type(error), error, _stacktrace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/util/util.py", line 39, in reraise
raise value
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 536, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=57885): Read timed out. (read timeout=120)
As you can see, it report timeout error, but when I request is by curl https://vip.stock.finance.sina.com.cn/mkt/#stock_hs_up, I get the result below immedietly, for sure the network is OK.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
url = "https://vip.stock.finance.sina.com.cn/mkt/#stock_hs_up"
option = webdriver.ChromeOptions()
option.add_argument('headless')
# here I need to set the correct binary path of chrome driver. It is a little bit different from code on Windows.
service = Service(executable_path='./chromedriver-linux64/chromedriver')
driver = webdriver.Chrome(options=option, service=service)
# driver = webdriver.Chrome()
driver.get(url)
width = driver.execute_script("return document.documentElement.scrollWidth")
height = driver.execute_script("return document.documentElement.scrollHeight")
driver.set_window_size(width, height)
driver.get_screenshot_as_file("webpage.png")
- OS: linux ubuntu
- Chrome version: Google Chrome 134.0.6998.88
- selenium version: 4.29.0
- the network is OK
Relevant log output
Traceback (most recent call last):
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 534, in _make_request
response = conn.getresponse()
^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connection.py", line 516, in getresponse
httplib_response = super().getresponse()
^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/http/client.py", line 1395, in getresponse
response.begin()
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/http/client.py", line 325, in begin
version, status, reason = self._read_status()
^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/http/client.py", line 286, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/socket.py", line 718, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cuichengyu/quantrading/test.py", line 17, in<module>
driver.get(url)
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 454, in get
self.execute(Command.GET, {"url": url})
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 427, in execute
response = self.command_executor.execute(driver_command, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 404, in execute
return self._request(command_info[0], url, body=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 428, in _request
response = self._conn.request(method, url, body=body, headers=headers, timeout=self._client_config.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/_request_methods.py", line 143, in request
return self.request_encode_body(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/_request_methods.py", line 278, in request_encode_body
return self.urlopen(method, url, **extra_kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/poolmanager.py", line 443, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 841, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/util/retry.py", line 474, in increment
raise reraise(type(error), error, _stacktrace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/util/util.py", line 39, in reraise
raise value
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 536, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/home/cuichengyu/anaconda3/envs/quantrading/lib/python3.11/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=57885): Read timed out. (read timeout=120)
Operating System
Ubuntu
Selenium version
4.29.0
What are the browser(s) and version(s) where you see this issue?
Chrome 134.0.6998.88
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 134.0.6998.88
Are you using Selenium Grid?
No response
The text was updated successfully, but these errors were encountered:
@dongrixinyu, 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.
@dongrixinyu if you want this issue investigated, please add debug logs and we will re-open it. The error you posted shows it is timing out communicating with chromedriver, not in reaching the remote URL.
What happened?
I tried to use selenium to get some pages on Windows as below:
This snippet above achieves what I want.
but when I execute it on Linux as below, it failed.
I failed to get the result.
As you can see, it report timeout error, but when I request is by
curl https://vip.stock.finance.sina.com.cn/mkt/#stock_hs_up
, I get the result below immedietly, for sure the network is OK.How can we reproduce the issue?
Relevant log output
Operating System
Ubuntu
Selenium version
4.29.0
What are the browser(s) and version(s) where you see this issue?
Chrome 134.0.6998.88
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 134.0.6998.88
Are you using Selenium Grid?
No response
The text was updated successfully, but these errors were encountered: