Skip to content

asyncio errors during cleanup if there are multiple CDP drivers present #3689

Closed
@mdmintz

Description

@mdmintz

asyncio errors during cleanup if there are multiple CDP drivers present.

Eg. ERROR:asyncio:Task was destroyed but it is pending!

This is a regression in 4.37.4. (This fixed the memory leak)

To reproduce:

from seleniumbase import SB

with SB(uc=True, test=True) as sb:
    url1 = "https://seleniumbase.io/demo_page"
    sb.activate_cdp_mode(url1)
    driver1 = sb.driver
    url2 = "https://seleniumbase.io/coffee/"
    driver2 = sb.get_new_driver(undetectable=True)
    sb.activate_cdp_mode(url2)
    print(driver1.get_current_url())
    print(driver2.get_current_url())
    sb.switch_to_default_driver()
    sb.assert_url_contains("demo_page")
    print(sb.get_current_url())
    sb.switch_to_driver(driver2)
    sb.assert_url_contains("coffee")
    print(sb.get_current_url())

Need to fix this without reverting the fix to the memory leak.

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