File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -721,7 +721,18 @@ def get_local_driver(
721
721
print ("\n Warning: chromedriver not found. Installing now:" )
722
722
sb_install .main (override = "chromedriver" )
723
723
sys .argv = sys_args # Put back the original sys args
724
- return webdriver .Chrome (options = chrome_options )
724
+ if not headless or "linux" not in PLATFORM :
725
+ return webdriver .Chrome (options = chrome_options )
726
+ else : # Running headless on Linux
727
+ try :
728
+ return webdriver .Chrome (options = chrome_options )
729
+ except Exception :
730
+ # Use the virtual display on Linux during headless errors
731
+ logging .debug ("\n Warning: Chrome failed to launch in"
732
+ " headless mode. Attempting to use the"
733
+ " SeleniumBase virtual display on Linux..." )
734
+ chrome_options .headless = False
735
+ return webdriver .Chrome (options = chrome_options )
725
736
except Exception as e :
726
737
if headless :
727
738
raise Exception (e )
You can’t perform that action at this time.
0 commit comments