Skip to content

asyncio errors on Python 3.11 (and older) #3715

Closed
@mdmintz

Description

@mdmintz

asyncio errors on Python 3.11 (and older)

Caused by a regression in4.37.10 for an edge case.

This isn't happening on Python 3.12 (or newer).

Python 3.12 made improvements to asyncio:

Image

There's a recent SeleniumBase asyncio memory-saving feature that works great on Python 3.12 (and newer), but it causes some asyncio errors on 3.11 and older because those versions of Python have an asyncio issue that wasn't fixed until Python 3.12.

This reproduces the issue on Python 3.11:

from seleniumbase import SB

with SB(uc=True, test=True) as sb:
    sb.activate_cdp_mode()
    sb.open("data:text/html,<h1>Page A</h1>")
    sb.assert_text("Page A")
    sb.open_new_tab()
    sb.open("data:text/html,<h1>Page B</h1>")
    sb.assert_text("Page B")
    sb.switch_to_tab(0)
    sb.assert_text("Page A")
    sb.assert_text_not_visible("Page B")
    sb.switch_to_tab(1)
    sb.assert_text("Page B")
    sb.assert_text_not_visible("Page A")
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task cancelling name='Task-3' coro=<Listener.listener_loop() running at ~/SeleniumBase/seleniumbase/undetected/cdp_driver/connection.py:575> wait_for=<Future pending cb=[Task.task_wakeup()]>>

Metadata

Metadata

Assignees

Labels

UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModebugUh oh... Something needs to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions