2727from seleniumbase .core import proxy_helper
2828from seleniumbase .core import sb_driver
2929from seleniumbase .fixtures import constants
30+ from seleniumbase .fixtures import js_utils
3031from seleniumbase .fixtures import shared_utils
3132
3233urllib3 .disable_warnings ()
@@ -406,9 +407,9 @@ def uc_open(driver, url):
406407 elif ":" not in url :
407408 url = "https://" + url
408409 if (url .startswith ("http:" ) or url .startswith ("https:" )):
409- time .sleep (0.05 )
410410 with driver :
411- driver .default_get (url )
411+ script = 'window.location.href = "%s";' % url
412+ js_utils .call_me_later (driver , script , 33 )
412413 else :
413414 driver .default_get (url ) # The original one
414415 return None
@@ -420,7 +421,6 @@ def uc_open_with_tab(driver, url):
420421 elif ":" not in url :
421422 url = "https://" + url
422423 if (url .startswith ("http:" ) or url .startswith ("https:" )):
423- time .sleep (0.05 )
424424 with driver :
425425 driver .execute_script ('window.open("%s","_blank");' % url )
426426 driver .close ()
@@ -439,7 +439,9 @@ def uc_open_with_reconnect(driver, url, reconnect_time=None):
439439 elif ":" not in url :
440440 url = "https://" + url
441441 if (url .startswith ("http:" ) or url .startswith ("https:" )):
442- driver .execute_script ('window.open("%s","_blank");' % url )
442+ script = 'window.open("%s","_blank");' % url
443+ js_utils .call_me_later (driver , script , 3 )
444+ time .sleep (0.007 )
443445 driver .close ()
444446 driver .reconnect (reconnect_time )
445447 driver .switch_to .window (driver .window_handles [- 1 ])
@@ -3878,7 +3880,7 @@ def get_local_driver(
38783880 service = service , options = chrome_options
38793881 )
38803882 return extend_driver (driver )
3881- except Exception :
3883+ except Exception as original_exception :
38823884 if is_using_uc (undetectable , browser_name ):
38833885 raise
38843886 # Try again if Chrome didn't launch
@@ -3914,8 +3916,11 @@ def get_local_driver(
39143916 log_output = os .devnull ,
39153917 service_args = ["--disable-build-check" ]
39163918 )
3917- driver = webdriver .Chrome (service = service )
3918- return extend_driver (driver )
3919+ try :
3920+ driver = webdriver .Chrome (service = service )
3921+ return extend_driver (driver )
3922+ except Exception :
3923+ raise original_exception
39193924 else :
39203925 raise Exception (
39213926 "%s is not a valid browser option for this system!" % browser_name
0 commit comments