Skip to content

Browser may freeze when using the async format with proxy auth when opening a 2nd URL #4104

@mdmintz

Description

@mdmintz

Browser may freeze when using the async format with proxy auth when opening a 2nd URL

This reproduces the issue on 4.44.11:

import asyncio
from seleniumbase import cdp_driver
from seleniumbase import decorators

async def main():
    driver = await cdp_driver.start_async(proxy="USER:PASS@IP:PORT")
    print("Opening first page")
    tab = await driver.get("https://seleniumbase.io/simple/login")
    print("Finding an element")
    h4 = await tab.select("h4")
    print(h4.text)
    await asyncio.sleep(2)
    print("Opening second page")
    tab = await driver.get("https://seleniumbase.io/demo_page")
    print("Finding an element")
    h1 = await tab.select("h1")
    print(h1.text)
    await asyncio.sleep(2)

if __name__ == "__main__":
    # Call an async function with awaited methods
    loop = asyncio.new_event_loop()
    with decorators.print_runtime("Async Example"):
        loop.run_until_complete(main())

Looks like the cause of the freeze is due to setting proxy auth more than once on the same browser instance.
(Proxy Auth is now being set via CDP because Chrome 142 won't let you set it via extension anymore. The CDP proxy auth step happens right before opening a new URL.)
To fix this, need to check if auth was already set on a browser instance before trying to set it.

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