Spaces:
Running
Running
File size: 936 Bytes
09801ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from playwright.sync_api import sync_playwright
def run():
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.on("console", lambda msg: print(f"Browser console: {msg.type}: {msg.text}"))
page.on("pageerror", lambda err: print(f"Browser error: {err}"))
print("Navigating to predictions page...")
page.goto("http://localhost:5174/ml-predictions", timeout=60000)
print("Waiting for 'Edit in IDE' button...")
try:
page.wait_for_selector("text='Edit in IDE'", timeout=5000)
print("Clicking 'Edit in IDE'...")
page.click("text='Edit in IDE'")
page.wait_for_timeout(2000)
print("Done clicking.")
except Exception as e:
print(f"Could not click Edit in IDE: {e}")
browser.close()
if __name__ == "__main__":
run()
|