mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 05:11:53 +09:00
24 lines
No EOL
691 B
Text
24 lines
No EOL
691 B
Text
# run uv run playwright open https://google.com/ --user_data_dir=~/.config/browseruse/profiles/default in shell
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
import os
|
|
|
|
user_data_dir = os.path.expanduser("~/.config/browseruse/profiles/default")
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch_persistent_context(
|
|
user_data_dir=user_data_dir,
|
|
headless=False,
|
|
)
|
|
page = browser.new_page()
|
|
page.goto("https://google.com")
|
|
|
|
# ctrl + c to exit
|
|
print("Press Ctrl+C to exit...")
|
|
try:
|
|
while True:
|
|
pass # Keep the script running
|
|
except KeyboardInterrupt:
|
|
print("Exiting...")
|
|
finally:
|
|
browser.close() |