Skip to content

Improve REPL support #160

@mxschmitt

Description

@mxschmitt

Currently the users have to heavily rely on indentation by using the context manager or using some hacky approach like that:

from playwright import sync_playwright

pw_context = sync_playwright()
p = pw_context.__enter__()

browser = p.chromium.launch()
page = browser.newPage()

def log_and_continue_request(route, request):
    print(request.url)
    route.continue_()

# Log and continue all network requests
page.route('**', lambda route, request: log_and_continue_request(route, request))

page.goto('http://todomvc.com')
browser.close()
pw_context.__exit__(None, None, None)

Probably we should add helper functions as aliases for the duner methods.

Reported via Reddit: https://www.reddit.com/r/Python/comments/i4z17w/playwright_a_python_library_to_automate_chromium/g0pb8qp?utm_source=share&utm_medium=web2x

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