12 lines
356 B
Python
12 lines
356 B
Python
|
|
from playwright.sync_api import sync_playwright, Playwright
|
||
|
|
|
||
|
|
def run(playwright: Playwright):
|
||
|
|
chromium = playwright.chromium # or "firefox" or "webkit".
|
||
|
|
browser = chromium.launch()
|
||
|
|
page = browser.new_page()
|
||
|
|
page.goto("http://example.com")
|
||
|
|
# other actions...
|
||
|
|
browser.close()
|
||
|
|
|
||
|
|
with sync_playwright() as playwright:
|
||
|
|
run(playwright)
|