Skip to content

[Bug]: browser_context.request: timeout argument is not working. #2944

@anarchy54

Description

@anarchy54

Version

latest

Steps to reproduce

import json

from playwright.sync_api import sync_playwright

# not working
with sync_playwright() as p:
    browser = p.chromium.launch(channel="msedge")
    context = browser.new_context()
    context.request.get(
        "https://fakeresponder.com", params={"sleep": 1000}, timeout=500
    )
    context.close()
    browser.close()


# working
with sync_playwright() as p:
    browser = p.chromium.launch(channel="msedge")
    context = p.request.new_context(timeout=500)
    response = context.get("https://fakeresponder.com", params={"sleep": 1000})
    print(json.dumps(response.json(), indent=4))
    browser.close()

Expected behavior

not working code is also subject to a timeout, raising

playwright._impl._errors.TimeoutError: APIRequestContext.get: Timeout 500ms exceeded.

should be raised.

Actual behavior

The not working code 500 ms timeout is ignored.

Additional context

No response

Environment

- Operating System: [MS Windows 11 Pro 64x]
- CPU: [Intel i9-13900K]
- Browser: [Chromium]
- Python Version: [3.12]
- Other info:

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