Skip to content

[BUG] if using playwright.chromium.connect_over_cdp() and then calling page.route() about 30% of the time the function never returns/hangs forever #11776

@sla-te

Description

@sla-te

Context:

  • Playwright Version: 1.17.2
  • Operating System: Windows
  • 3.10.1
  • Browser: Chromium

Code Snippet

import re

from playwright.sync_api import sync_playwright
from string import ascii_letters
from random import choice

def block(route, request):
    route.abort()

with sync_playwright() as p:
    browser = playwright.chromium.connect_over_cdp(endpoint_url=ws, timeout=60000, slow_mo=20)
    context = browser.contexts[0]
    page = context.pages[0] if context.pages else context.new_page()
    page.route(re.compile("http(s)?://google.com/.*", block)
    page.wait_for_timeout(5000)

Describe the bug
It happens often, around 30% of the times - When calling page.route the function never returns and hangs there forever. Whatever is going wrong - for sure a timeout is missing there that should throw after an amount of time. - Sadly if this happens its also almost impossible to get back control.

EDIT: Meanwhile tested with sync and async version, happens with both.

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