diff --git a/playw.py b/playw.py index 4266983a1..1a97b98c4 100644 --- a/playw.py +++ b/playw.py @@ -1,7 +1,16 @@ from playwright.sync_api import sync_playwright import sys +from playwright.__main__ import main as playwright_install def main(url): + # Check if Chromium is installed, if not, install it + try: + with sync_playwright() as p: + p.chromium.launch() + except Exception as e: + print("Chromium is not installed. Installing necessary dependencies...") + playwright_install(['install', 'chromium']) + with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page()