Skip to content

[Bug]: On 1.57.0, calling p.chromium.connect_over_cdp() leads to DeprecationWarning: url.parse() behavior is not standardized #3016

@mdmintz

Description

@mdmintz

Version

1.57.0

Steps to reproduce

Here's a full example that reproduces the issue.
It spins up a browser on remote-debugging-port 9222.
Then it creates a new session from the existing session.

import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p0:
        kwargs = {"headless": False, "args": ["--remote-debugging-port=9222"]}
        browser = await p0.chromium.launch(**kwargs)
        await browser.new_browser_cdp_session()

        async with async_playwright() as p:
            endpoint_url = "http://127.0.0.1:9222"
            browser = await p.chromium.connect_over_cdp(endpoint_url)
            context = await browser.new_context()
            page = await context.new_page()
            await context.close()
            await browser.close()

if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())

This leads to:

(node:88758) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications.
Use the WHATWG URL API instead.
CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)

That warning happens when reaching this line:
browser = await p.chromium.connect_over_cdp(endpoint_url)

Expected behavior

I expect no DeprecationWarning for url.parse() when running this code.
This same code worked correctly on previous versions of playwright.

Actual behavior

A DeprecationWarning for url.parse() appeared:

(node:88758) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications.
Use the WHATWG URL API instead.
CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)

Additional context

No response

Environment

- Operating System: macOS M2 MacBook Air
- CPU: ARM64
- Browser: Chromium
- Python Version: 3.14

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