Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I try use your example code, but it don't work... #1882

Open
allrobot opened this issue May 12, 2024 · 0 comments
Open

I try use your example code, but it don't work... #1882

allrobot opened this issue May 12, 2024 · 0 comments

Comments

@allrobot
Copy link

allrobot commented May 12, 2024

I used command:

pip install undetected-chromedriver

and used you give code:

import undetected_chromedriver as uc
driver = uc.Chrome(headless=True,use_subprocess=False)
driver.get('https://nowsecure.nl')
driver.save_screenshot('nowsecure.png')

It always displays error WinError 10054.

C:\ProgramData\anaconda3\envs\python311\python.exe C:\Users\Administrator\Personal_scripts\pythonProject\temp.py 
Traceback (most recent call last):
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\ProgramData\anaconda3\envs\python311\Lib\http\client.py", line 1303, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\ProgramData\anaconda3\envs\python311\Lib\http\client.py", line 1349, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\ProgramData\anaconda3\envs\python311\Lib\http\client.py", line 1298, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\ProgramData\anaconda3\envs\python311\Lib\http\client.py", line 1058, in _send_output
    self.send(msg)
  File "C:\ProgramData\anaconda3\envs\python311\Lib\http\client.py", line 996, in send
    self.connect()
  File "C:\ProgramData\anaconda3\envs\python311\Lib\http\client.py", line 1475, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\ssl.py", line 1104, in _create
    self.do_handshake()
  File "C:\ProgramData\anaconda3\envs\python311\Lib\ssl.py", line 1382, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\Personal_scripts\pythonProject\temp.py", line 3, in <module>
    driver = uc.Chrome(headless=True,use_subprocess=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\site-packages\undetected_chromedriver-3.5.5-py3.11.egg\undetected_chromedriver\__init__.py", line 258, in __init__
    self.patcher.auto()
  File "C:\ProgramData\anaconda3\envs\python311\Lib\site-packages\undetected_chromedriver-3.5.5-py3.11.egg\undetected_chromedriver\patcher.py", line 178, in auto
    self.unzip_package(self.fetch_package())
                       ^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\site-packages\undetected_chromedriver-3.5.5-py3.11.egg\undetected_chromedriver\patcher.py", line 287, in fetch_package
    return urlretrieve(download_url)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 241, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
                            ^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\python311\Lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10054] 远程主机强迫关闭了一个现有的连接。>

Even if I try to change the website address or use driver.options.add_argument('--proxy-server=http://127.0.0.1:14937'), I still receive a WinError 10054. Is it related to my use of VPN clash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant