Skip to content

[Bug or setup issue] Indefinite wait when running cdp commands #240

@Soggy-Pancake

Description

@Soggy-Pancake

I am trying to connect to a chrome instance running within a docker container from the host. It seems to have successfully connected but it indefinitely waits for a response and does nothing after calling tab.query_selector() or browser.get(). This happens with both nodriver and zendriver.

Logs:

DevTools listening on ws://0.0.0.0:9315/devtools/browser/1d9513fe-970e-48f1-8828-7f2ca13d0201
[0202/005822.142758:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable. // This is from my chrome container
Connecting to browser...
Connected? <nodriver.core.browser.Browser object at 0x7f92e332d750>
<Tab [6F618B46378FC8A4D2F516D1A4D5DFC4] [page] [url: about:blank]>
Current page: about:blank
^CTraceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File ".../Python/chromeInDocker/chromeInDocker.py", line 222, in main
    await asyncio.sleep(0.1)
                  ^^^^^^^^^^^
  File ".../Python/chromeInDocker/venv/lib/python3.11/site-packages/nodriver/core/tab.py", line 562, in query_selector
    doc: cdp.dom.Node = await self.send(cdp.dom.get_document(-1, True))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../Python/chromeInDocker/venv/lib/python3.11/site-packages/nodriver/core/connection.py", line 522, in send
    return await tx
           ^^^^^^^^
asyncio.exceptions.CancelledError

System info:
TrueNAS Scale 25.04.0
Python 3.11

Docker container running chrome is zenika/alpine-chrome with the arguments --no-sandbox --no-first-run --remote-debugging-address=0.0.0.0 --remote-allow-origins=* --remote-debugging-port=9315 about:blank

I can reach the devtools /json/version with no issues.

Here is an example of where it is getting stuck.

print("getting login button")
button = await page.query_selector("#thebutton")
print("The button:", button) # never gets printed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions