Closed hugoman closed 1 year ago
@hugoman
I am invoking it from ssh on server.
We have xvfb installed also but have no idea how to launch it from your plugin.
Dňa po 7. 8. 2023, 17:21 kaliiiiiiiiiii @.***> napísal(a):
@hugoman https://github.com/hugoman
- Does Chrome startup as a window?
— Reply to this email directly, view it on GitHub https://github.com/kaliiiiiiiiii/Selenium-Driverless/issues/14#issuecomment-1668080335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVV5OKRBE3RHQBJCVU3RUDXUEBXTANCNFSM6AAAAAA3HA4KMA . You are receiving this because you were mentioned.Message ID: @.***>
@hugoman are you running as root?
@hugoman are you running as root?
No, its necessary? Selenium or pptr run nicely without root. If need any args without root, let me know.
@hugoman are you running as root?
No, its necessary? Selenium or pptr run nicely without root. If need any args without root, let me know.
nope, wouldn't recommend using root as well
I'll provide you some instructions for checking why chrome crashed
ok, let me know how to debug more...
@hugoman execute the following code:
import os
from selenium_driverless.utils.utils import find_chrome_executable
path = find_chrome_executable()
cmd = f'"{path}" --remote-debugging-port=9222'
os.system(cmd)
to check if chrome starts correctly (feel free to provide the output)
You should get something similar to
DevTools listening on ws://127.0.0.1:9222/devtools/browser/81c796a2-ca3a-4a53-9bd5-6d51fa1530f9
as the output
on MacOS:
error in CDPConnection.connect() (attempt 1 of 10,
at /venv/lib/python3.11/site-packages/selenium_driverless/pycdp/asyncio.py:283), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=61340, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(61, "Connect call failed ('127.0.0.1', 61340)"))
DevTools listening on ws://127.0.0.1:9222/devtools/browser/97231614-ed03-464c-8d38-945ca617e969
[71749:259:0808/111241.688497:ERROR:feature_processor_state.cc(39)] Processing error occured: model WebAppInstallationPromo failed with UkmEngineDisabled, message:
on MacOS:
error in CDPConnection.connect() (attempt 1 of 10, at /venv/lib/python3.11/site-packages/selenium_driverless/pycdp/asyncio.py:283), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=61340, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(61, "Connect call failed ('127.0.0.1', 61340)"))
DevTools listening on ws://127.0.0.1:9222/devtools/browser/97231614-ed03-464c-8d38-945ca617e969 [71749:259:0808/111241.688497:ERROR:feature_processor_state.cc(39)] Processing error occured: model WebAppInstallationPromo failed with UkmEngineDisabled, message:
@tnt2k mhh don't see the issue yet🤔 maybe the profile-path-directory dosn't have the correct permissions?
@tnt2k @hugoman Can you try with the following scripts then?:
import os
from selenium_driverless.utils.utils import find_chrome_executable
path = find_chrome_executable()
user_data_dir = 'C:/some/temp/path_with_permissions'
cmd = f'"{path}" --remote-debugging-port=9222 --user-data-dir="{user_data_dir}"'
os.system(cmd)
or
from selenium_profiles.webdriver import Chrome
from selenium_profiles.profiles import profiles
from selenium_driverless.webdriver import ChromeOptions
user_data_dir = 'C:/some/temp/path_with_permissions'
options = ChromeOptions()
options.add_argument(f'--user-data-dir="{user_data_dir}"')
profile = profiles.Windows()
driver = Chrome(profile, options=options, driverless_options=True)
@kaliiiiiiiiii
worth adding the default --no-first-run
option to the package
error in CDPConnection.connect() (attempt 1 of 10, at /venv/lib/python3.11/site-packages/selenium_driverless/pycdp/asyncio.py:283), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=61897, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(61, "Connect call failed ('127.0.0.1', 61897)"))
Traceback (most recent call last):
File "/venv/lib/python3.11/site-packages/selenium_driverless/sync/webdriver.py", line 23, in quit
asyncio.get_running_loop()
RuntimeError: no running event loop
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/1st.py", line 12, in <module>
driver.quit()
File "_/venv/lib/python3.11/site-packages/selenium_profiles/webdriver.py", line 209, in quit
super().quit()
File "_/venv/lib/python3.11/site-packages/selenium_driverless/sync/webdriver.py", line 26, in quit
return self._loop.run_until_complete(super().quit())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
self.run_forever()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1884, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/selectors.py", line 561, in select
kev_list = self._selector.control(None, max_ev, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
_/venv/lib/python3.11/site-packages/selenium_driverless/webdriver.py:441: RuntimeWarning: coroutine 'Chrome.stop_client' was never awaited
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
error in CDPConnection.connect() (attempt 1 of 10, at _/venv/lib/python3.11/site-packages/selenium_driverless/pycdp/asyncio.py:283), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=61897, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(61, "Connect call failed ('127.0.0.1', 61897)"))
Traceback (most recent call last):
File "_/venv/lib/python3.11/site-packages/selenium_driverless/sync/webdriver.py", line 23, in quit
asyncio.get_running_loop()
RuntimeError: no running event loop
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "_/1st.py", line 12, in <module>
driver.quit()
File "_/venv/lib/python3.11/site-packages/selenium_profiles/webdriver.py", line 209, in quit
super().quit()
File "_/venv/lib/python3.11/site-packages/selenium_driverless/sync/webdriver.py", line 26, in quit
return self._loop.run_until_complete(super().quit())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
self.run_forever()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1884, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/selectors.py", line 561, in select
kev_list = self._selector.control(None, max_ev, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
_/venv/lib/python3.11/site-packages/selenium_driverless/webdriver.py:441: RuntimeWarning: coroutine 'Chrome.stop_client' was never awaited
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
@tnt2k mhh don't see the issue yet🤔 maybe the profile-path-directory dosn't have the correct permissions?
I use venv
@tnt2k are you familiar with debugging? If yes, could you
venv/Lib/site-packages/selenium_driverless/webdriver.py
in line 197
at
browser = subprocess.Popen(
[options["binary"], *options["args"]],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=IS_POSIX,
)
options["args"]
and options["binary"]
aredriver._options.debugger_address
port is acessible (you can get f"http://{driver._options.debugger_address}/json"
for testing)Do you mean manual start with arguments including the same remote-debugging-port?
couldn't reproduce this issue on Linux kali 5.15.74-android13-8-o-gaa4c29b7e680 #1 SMP PREEMPT Tue Jun 20 11:26:50 UTC 2023 aarch64 GNU/Linux
Do you mean manual start with arguments including the same remote-debugging-port? yeah, with
- same remote-debugging-port
- same user-data-dir
and then check f"http://localhost:{port}/json"
host
Do you mean manual start with arguments including the same remote-debugging-port? yeah, with
- same remote-debugging-port
- same user-data-dir
and then check
f"http://localhost:{port}/json"
host
works. as expected, I see two connections on the same port initiated by hands and a script.
works. as expected, I see two connections on the same port initiated by hands and a script.
huh intere ting
can you provide what you get on f"http://localhost:{port}/json"
?
works. as expected, I see two connections on the same port initiated by hands and a script.
huh intere ting
can you provide what you get on
f"http://localhost:{port}/json"
?[ { "description": "", "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:49176/devtools/page/62361E063B121A23BC9B7AA4619A385A", "id": "62361E063B121A23BC9B7AA4619A385A", "title": "Новая вкладка", "type": "page", "url": "http://127.0.0.1:49176/json", "webSocketDebuggerUrl": "ws://127.0.0.1:49176/devtools/page/62361E063B121A23BC9B7AA4619A385A" }, { "description": "", "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:49176/devtools/page/6207AE0FA1CD08C71D7876B57BED13FC", "id": "6207AE0FA1CD08C71D7876B57BED13FC", "parentId": "62361E063B121A23BC9B7AA4619A385A", "title": "chrome-untrusted://new-tab-page/one-google-bar?paramsencoded=", "type": "iframe", "url": "chrome-untrusted://new-tab-page/one-google-bar?paramsencoded=", "webSocketDebuggerUrl": "ws://127.0.0.1:49176/devtools/page/6207AE0FA1CD08C71D7876B57BED13FC" } ]
@tnt2k can you try the following version?
pip install --no-cache https://github.com/kaliiiiiiiiii/Selenium-Driverless/archive/refs/heads/dev.zip
or
import subprocess
cmd = '"google-chrome" --no-first-run --password-store=basic --user-data-dir=/home/some_temp_dir --remote-debugging-port=38327'
browser = subprocess.Popen(
cmd ,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True
shell=True
)
# get chrome://version to check if arguments got applied correctly
Running chrome without display on linux server
/opt/google/chrome/chrome --remote-debugging-port=9222 --no-first-run --disable-gpu
produce this:
[285351:285351:0809/111733.350562:ERROR:ozone_platform_x11.cc(239)] Missing X server or $DISPLAY
[285351:285351:0809/111733.350591:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
If i try to run it with xvfb, then the chrome starts with only one error at end and seems to be running well, like:
xvfb-run /opt/google/chrome/chrome --remote-debugging-port=9222 --no-first-run --disable-gpu
this cmd produces only one error:
DevTools listening on ws://127.0.0.1:9222/devtools/browser/62185f55-2740-47be-9f8d-4750d514ff31
[285782:285782:0809/112131.380195:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.portal.Error.NotFound: Requested setting not found
Is here any possible way to change the binary in options manualy and set it to use xvfb display or any other fake display?
@hugoman I think PyVirtualDisplay should work fine
from pyvirtualdisplay import Display
disp = Display()
disp.start()
driver = webdriver.Chrome()
#....
driver.quit()
disp.stop()
Installation with:
pip install PyVirtualDisplay
sudo apt-get install xvfb xserver-xephyr tigervnc-standalone-server x11-utils gnumeric
previously (documentation instructions for ubuntu)Running
from pyvirtualdisplay import Display
from selenium_driverless import webdriver
import asyncio
async def main():
disp = Display()
disp.start()
options = webdriver.ChromeOptions()
options.add_argument(f'--user-data-dir=/tmp/chrome1')
options.add_argument('--no-first-run')
options.add_argument('--disable-gpu')
#options.add_argument('--binary_location="xvfb-run /opt/google/chrome/chrome"')
async with webdriver.Chrome(options=options) as driver:
await driver.get('http://nowsecure.nl#relax')
await driver.implicitly_wait(3)
title = await driver.title
url = await driver.current_url
source = await driver.page_source
print(title)
driver.quit()
disp.stop()
asyncio.run(main())
does always result in error:
error in CDPConnection.connect() (attempt 1 of 10, at /home/me/.local/lib/python3.9/site-packages/selenium_driverless/pycdp/asyncio.py:283), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=35731, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 35731)"))
Just a moment...
/home/me/public_html/crawlers/test/python_driverless.py:28: RuntimeWarning: coroutine 'Chrome.quit' was never awaited
driver.quit()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
When i add await
to await driver.quit()
then the errorlog ends with row:
Just a moment...
and process is just hanging, not stopping.
@hugoman your output indicates to me that it does run with pyvirtualdisplay.
driver.quit()
statement when running with async with ...
or with ...
exit()
after disp.stop()
might helpImplemented both, but freezing after 5 seconds now :) :
error in CDPConnection.connect() (attempt 1 of 10, at /home/me/.local/lib/python3.9/site-packages/selenium_driverless/pycdp/asyncio.py:283), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=44023, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 44023)"))
Just a moment...
Is any way to see whats the problem with chrome process?
Can this error, when running chrome standalone without calling driverless directly preventing from connecting to chrome?
[285782:285782:0809/112131.380195:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.portal.Error.NotFound: Requested setting not found
@hugoman
Just a moment...
indicates that your code did run successfully till print(title)
, but then didn't exit cleanly.xvfb
or your Rocky Linux
distributionerror in CDPConnection.connect() (attempt 1 of 10 ...
only tells you that the first connect try didn't work. You can safely ignore this warning@hugoman is this issue resolved? I'll be closing this issue if there's no respnse and assume it's fixed now
@hugoman
Just a moment...
indicates that your code did run successfully tillprint(title)
, but then didn't exit cleanly.- I don't know if the error could be related to that blocking exit.
- the error seems to me related to
xvfb
or yourRocky Linux
distributionerror in CDPConnection.connect() (attempt 1 of 10 ...
only tells you that the first connect try didn't work. You can safely ignore this warning
print(title)
but it not pass the cloudflare protection, just shows the checkbox on linux...xvfb-run
seems to work well on puppeteer, but here is too NOT possible to pass the webdriver check at cloudflare even with clicks() they know its puppeteer, even stealth, modded, extensions installed etc...error in CDPConnection.connect() (attempt 1 of 10 ...
- yes it looks like the first try to connect to devtools is not working, but the second yes, this works.For anyone more interested, we resolved this error too:
[302643:302643:0809/162215.014290:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.portal.Error.NotFound: Requested setting not found
Installing: xdg-desktop-portal
Found solution here: https://github.com/flatpak/flatpak/issues/5201#issuecomment-1337471997
It looks that cloudflare looks very much after GPU (so arg --disable-gpu
is a NO-NO!), but linux servers dont have it, here may be way to mock the behaviour or fake it, so we may enter without clicking the checkbox like on windows machine, where its almost instant.
uninstalling selenium-driverless and installing newest ver. via pip it currently not print in loop: error in CDPConnection.connect() (attempt 1 of 10 ...
Running same code:
import time
from selenium_driverless.sync import webdriver
from selenium_driverless.types.by import By
options = webdriver.ChromeOptions()
with webdriver.Chrome(options=options) as driver:
driver.get('http://nowsecure.nl#relax')
driver.implicitly_wait(10)
title = driver.title
print(title)
driver.quit()
BUT this huge tracelog:
Traceback (most recent call last):
File "/home/me/.local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 189, in connect_tcp
addr_obj = ip_address(remote_host)
File "/usr/lib64/python3.9/ipaddress.py", line 53, in ip_address
raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: 'localhost' does not appear to be an IPv4 or IPv6 address
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/socket.py", line 188, in _connect
ws_url = await get_websock_url(self._port, self._host_, timeout=None)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/utils/conn.py", line 25, in get_websock_url
_json = await get_json(host, timeout=timeout)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/utils/conn.py", line 16, in get_json
res = await get_http(f"http://{host}/json", timeout=timeout)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/utils/conn.py", line 8, in get_http
result = await client.get(url=url, timeout=timeout)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1757, in get
return await self.request(
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
stream = await self._connect(request)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 117, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/home/me/.local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 192, in connect_tcp
gai_res = await getaddrinfo(
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.9/asyncio/tasks.py", line 490, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/me/public_html/crawlers/test/chrome_test1.py", line 7, in <module>
with webdriver.Chrome(options=options) as driver:
File "/home/me/.local/lib/python3.9/site-packages/selenium_driverless/sync/webdriver.py", line 13, in __init__
self.start_session()
File "/home/me/.local/lib/python3.9/site-packages/selenium_driverless/sync/webdriver.py", line 37, in syncified
return self._loop.run_until_complete(item(*args, **kwargs))
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/me/.local/lib/python3.9/site-packages/selenium_driverless/webdriver.py", line 223, in start_session
self._base = await CDPSocket(port=port, host=host, loop=self._loop)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/socket.py", line 185, in start_session
return await asyncio.wait_for(self._connect(), timeout=timeout)
File "/usr/lib64/python3.9/asyncio/tasks.py", line 492, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Is somehow possible to set custom IP/servername + port?
@hugoman oh yep, that might actually be my bad
can you try if pip install selenium-driverless==1.3.2.1
works?
thanks for your neverending help, but it not helps, i have almost identical error, only 3 different lines, you can compare this:
Traceback (most recent call last):
File "/home/me/.local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 189, in connect_tcp
addr_obj = ip_address(remote_host)
File "/usr/lib64/python3.9/ipaddress.py", line 53, in ip_address
raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: 'localhost' does not appear to be an IPv4 or IPv6 address
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/socket.py", line 189, in _connect
ws_url = await get_websock_url(self._port, self._host_, timeout=None)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/utils/conn.py", line 25, in get_websock_url
_json = await get_json(host, timeout=timeout)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/utils/conn.py", line 16, in get_json
res = await get_http(f"http://{host}/json", timeout=timeout)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/utils/conn.py", line 8, in get_http
result = await client.get(url=url, timeout=timeout)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1757, in get
return await self.request(
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "/home/me/.local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
stream = await self._connect(request)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 117, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
File "/home/me/.local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/home/me/.local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 192, in connect_tcp
gai_res = await getaddrinfo(
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.9/asyncio/tasks.py", line 490, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/me/public_html/crawlers/test/chrome_test1.py", line 7, in <module>
with webdriver.Chrome(options=options) as driver:
File "/home/me/.local/lib/python3.9/site-packages/selenium_driverless/sync/webdriver.py", line 13, in __init__
self.start_session()
File "/home/me/.local/lib/python3.9/site-packages/selenium_driverless/sync/webdriver.py", line 37, in syncified
return self._loop.run_until_complete(item(*args, **kwargs))
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/me/.local/lib/python3.9/site-packages/selenium_driverless/webdriver.py", line 220, in start_session
self._base = await CDPSocket(port=port, host=host, loop=self._loop)
File "/home/me/.local/lib/python3.9/site-packages/cdp_socket/socket.py", line 186, in start_session
return await asyncio.wait_for(self._connect(), timeout=timeout)
File "/usr/lib64/python3.9/asyncio/tasks.py", line 492, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
with https://github.com/kaliiiiiiiiii/Selenium-Driverless/issues/14#issuecomment-1678663972
or is possible to set debugger_address IP manualy? I think here can be DNS resolve problem with localhost.
@hugoman
- tried to hardcode local ip or different hostnames but same error
did you try replacing
host = f"{host}:{port}"
at
https://github.com/kaliiiiiiiiii/CDP-Socket/blob/a48f17cd4ab9335b33d3d71919cc8d9a3decafd3/src/cdp_socket/utils/conn.py#L23 ?
Note: unfortanely still can't reproduce the issue:/
@hugoman can you try pip install selenium-driverless==1.3.4
?
@hugoman can you try
pip install selenium-driverless==1.3.4
?
Same error.... asyncio.exceptions.TimeoutError
@daVinci13 does bare selenium run? if not, fix that first. seems like chrome doesn't start
Don't think you've got the same issue as @hugoman
Yes I'm sure. Code works with bare selenium.
I'm getting the same issue on mac, @kaliiiiiiiiii happy to hop on a call of some sort and you can play around w/ my machine to diagnose?
I'm getting the same issue on mac, @kaliiiiiiiiii happy to hop on a call of some sort and you can play around w/ my machine to diagnose?
@pstefa1707 You mean like screen-share//screen remote call? Yeah sure, my discord username is steve_abcdef
if that works for you. We can communicate there abt when we've got time.
Unfortanely, I haven't been able to reproduce this issue so far (on any device I hav access to), therefore that might actually help a lot
added
Hi @kaliiiiiiiiii, did you end up finding a fix for this? Experiencing same issue on mac
Hi @kaliiiiiiiiii, did you end up finding a fix for this? Experiencing same issue on mac
@srichards2103 Yeah, I think the next release should fix this issue
@pstefa1707 @daVinci13 @hugoman @tnt2k
The new release (1.5
) is out, and I'm pretty sure that those issues should be resolved now
Feel free to give me a feedback tho:)
closing because of inactivity
Hello folks!
When i run
python3 selenium_detector.py
from windows, it works flawlesly but executing from linux machine it shows:error in CDPConnection.connect() (attempt 1 of 10, at /home/me/.local/lib/python3.9/site-packages/selenium_driverless/pycdp/asyncio.py:289), retrying: ClientConnectorError(ConnectionKey(host='localhost', port=60413, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 60413)"))
I have all dependencies installed and it shows the same error when i run the first async code example when it hits line with:
await driver.get('http://nowsecure.nl#relax')