-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_browser_logs.py
More file actions
35 lines (29 loc) · 1.04 KB
/
Copy pathget_browser_logs.py
File metadata and controls
35 lines (29 loc) · 1.04 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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
options = Options()
options.add_argument('--headless')
options.set_capability('goog:loggingPrefs', {'browser': 'ALL'})
try:
print("Launching browser...")
driver = webdriver.Chrome(options=options)
driver.get("http://localhost:8000/")
time.sleep(2)
print("Navigating to Results...")
driver.execute_script('''
const select = document.getElementById('results-mission-select');
for (let i = 0; i < select.options.length; i++) {
if (select.options[i].value !== "") {
select.value = select.options[i].value;
select.dispatchEvent(new Event('change'));
break;
}
}
''')
time.sleep(3) # Wait for Plotly to render
print("\n--- BROWSER CONSOLE LOGS ---")
for entry in driver.get_log('browser'):
print(f"[{entry['level']}] {entry['message']}")
driver.quit()
except Exception as e:
print("Error:", e)