From 5a06508e0e704367bba8834d379a624d4bf087f8 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 8 Feb 2024 07:58:59 -0800 Subject: [PATCH] Install Chromium if not already installed before launching it. --- playw.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/playw.py b/playw.py index 1a97b98c4..b120f87ec 100644 --- a/playw.py +++ b/playw.py @@ -4,17 +4,14 @@ 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: + p.chromium.launch() with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() page.goto(url) + #page.wait_for_load_state('networkidle') content = page.content() print(content) browser.close()