Skip to content

Instantly share code, notes, and snippets.

@devinschumacher
Last active July 5, 2024 22:37
Show Gist options
  • Select an option

  • Save devinschumacher/21607a41a9b371d0c551c7f263cb7387 to your computer and use it in GitHub Desktop.

Select an option

Save devinschumacher/21607a41a9b371d0c551c7f263cb7387 to your computer and use it in GitHub Desktop.
python playwright REPL interactive mode boilerplate
# boilerplate start
from playwright.sync_api import sync_playwright
playwright = sync_playwright().start()
browser = playwright.chromium.launch(headless=False, slow_mo=100)
page = browser.new_page()
# set the URL destination
url = "https://playwright.dev/python"
# visit the URL https://playwright.dev/python
page.goto(url)
# boilerplate end ----------
# select the "GET STARTED" button on the visited URL
btn = page.get_by_role("link", name="GET STARTED")
# highlight the selected element for visual confirmation
btn.highlight()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment