File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
.github/workflows/scripts Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ def run_headless_test():
13
13
if args .browser_type .lower () == 'chrome' :
14
14
options = webdriver .ChromeOptions ()
15
15
options .add_argument ("--headless=new" )
16
- driver = webdriver .Chrome (options = options )
16
+ options .set_capability ("goog:loggingPrefs" , {"browser" : "ALL" })
17
+ service = webdriver .ChromeService (log_output = "chrome-driver.log" )
18
+ driver = webdriver .Chrome (options = options , service = service )
17
19
elif args .browser_type .lower () == 'firefox' :
18
20
options = webdriver .FirefoxOptions ()
19
21
options .add_argument ("--headless" )
@@ -36,6 +38,13 @@ def run_headless_test():
36
38
with open (result_file , "w" , encoding = "utf-8" ) as file :
37
39
file .write (html )
38
40
41
+ if args .browser_type .lower () == 'chrome' :
42
+ logs = driver .get_log ('browser' )
43
+ # Save console logs to a file for easier debugging
44
+ with open ("chrome-console.log" , "w" , encoding = "utf-8" ) as f :
45
+ for entry in logs :
46
+ f .write (f"[{ entry ['level' ]} ] { entry ['message' ]} \n " )
47
+
39
48
finally :
40
49
driver .quit ()
41
50
You can’t perform that action at this time.
0 commit comments