Skip to content

Commit ef0aedc

Browse files
committed
Improve error-handling around browser launches
1 parent b2ec928 commit ef0aedc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,17 +3833,29 @@ def get_local_driver(
38333833
)
38343834
return extend_driver(driver)
38353835
except Exception:
3836+
if is_using_uc(undetectable, browser_name):
3837+
raise
3838+
# Try again if Chrome didn't launch
38363839
try:
3837-
# Try again if Chrome didn't launch
38383840
service = ChromeService(service_args=["--disable-build-check"])
38393841
driver = webdriver.Chrome(
38403842
service=service, options=chrome_options
38413843
)
38423844
return extend_driver(driver)
38433845
except Exception:
38443846
pass
3845-
if headless:
3847+
if user_data_dir:
3848+
print("\nUnable to set user_data_dir while starting Chrome!\n")
3849+
raise
3850+
elif mobile_emulator:
3851+
print("\nFailed to start Chrome's mobile device emulator!\n")
3852+
raise
3853+
elif extension_zip or extension_dir:
3854+
print("\nUnable to load extension while starting Chrome!\n")
3855+
raise
3856+
elif headless or headless2 or IS_LINUX or proxy_string or use_wire:
38463857
raise
3858+
# Try running without any options (bare bones Chrome launch)
38473859
if LOCAL_CHROMEDRIVER and os.path.exists(LOCAL_CHROMEDRIVER):
38483860
try:
38493861
make_driver_executable_if_not(LOCAL_CHROMEDRIVER)

0 commit comments

Comments
 (0)