-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_browser_launch.py
More file actions
39 lines (30 loc) · 1.03 KB
/
test_browser_launch.py
File metadata and controls
39 lines (30 loc) · 1.03 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
"""
Simple test to verify browser launches without crashing
"""
import os
import sys
from dotenv import load_dotenv
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
# Load environment
load_dotenv(os.path.join(os.path.dirname(__file__), '.env'))
from predicate import PredicateBrowser
print("Testing browser launch...")
print("This will open a browser window for 5 seconds then close it.")
print()
try:
with PredicateBrowser(headless=False) as browser:
print("✅ Browser launched successfully!")
print(f" Browser type: {browser.context.browser.browser_type.name}")
# Navigate to a simple page
browser.page.goto("https://example.com")
print("✅ Navigation successful!")
# Wait a moment
import time
time.sleep(5)
print("✅ Browser closed successfully!")
print("\n🎉 All tests passed! The browser works without crashes.")
except Exception as e:
print(f"\n❌ Browser test failed: {e}")
import traceback
traceback.print_exc()
sys.exit(1)