-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
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
Labels
No labels