Spaces:
Runtime error
Runtime error
Download frontend/test_frontend.py from datavision-ai/Datavision: direct link, hf CLI and curl.
- Browser
- Download file 936 Bytes
-
https://huggingface.co/spaces/datavision-ai/Datavision/resolve/main/frontend/test_frontend.py
- Command line
-
hf download hf://spaces/datavision-ai/Datavision/frontend/test_frontend.py
-
curl -L -o test_frontend.py https://huggingface.co/spaces/datavision-ai/Datavision/resolve/main/frontend/test_frontend.py
936 Bytes
| 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() | |