mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
Install Chromium if not already installed before launching it.
This commit is contained in:
parent
09de0f5d43
commit
5a06508e0e
1 changed files with 3 additions and 6 deletions
9
playw.py
9
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue