Last active
July 5, 2024 22:37
-
-
Save devinschumacher/21607a41a9b371d0c551c7f263cb7387 to your computer and use it in GitHub Desktop.
python playwright REPL interactive mode boilerplate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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