@@ -2702,13 +2702,16 @@ def get_local_driver(
2702
2702
)
2703
2703
return driver
2704
2704
elif browser_name == constants .Browser .SAFARI :
2705
- from selenium .webdriver .safari .options import Options as SafariOptions
2706
-
2707
2705
arg_join = " " .join (sys .argv )
2708
2706
if ("-n" in sys .argv ) or (" -n=" in arg_join ) or (arg_join == "-c" ):
2709
2707
# Skip if multithreaded
2710
2708
raise Exception ("Can't run Safari tests in multithreaded mode!" )
2711
2709
warnings .simplefilter ("ignore" , category = DeprecationWarning )
2710
+ if not selenium4_or_newer :
2711
+ return webdriver .safari .webdriver .WebDriver ()
2712
+
2713
+ from selenium .webdriver .safari .options import Options as SafariOptions
2714
+
2712
2715
service = SafariService (quiet = False )
2713
2716
options = SafariOptions ()
2714
2717
if (
@@ -3270,7 +3273,10 @@ def get_local_driver(
3270
3273
elif "Missing or invalid capabilities" in e .msg :
3271
3274
if selenium4_or_newer :
3272
3275
chrome_options .add_experimental_option ("w3c" , True )
3273
- service = ChromeService (log_output = os .devnull )
3276
+ service = ChromeService (
3277
+ log_output = os .devnull ,
3278
+ service_args = service_args ,
3279
+ )
3274
3280
with warnings .catch_warnings ():
3275
3281
warnings .simplefilter (
3276
3282
"ignore" , category = DeprecationWarning
@@ -3369,6 +3375,7 @@ def get_local_driver(
3369
3375
if selenium4_or_newer :
3370
3376
service = ChromeService (
3371
3377
executable_path = LOCAL_CHROMEDRIVER ,
3378
+ log_output = os .devnull ,
3372
3379
service_args = ["--disable-build-check" ],
3373
3380
)
3374
3381
driver = webdriver .Chrome (
@@ -3384,6 +3391,7 @@ def get_local_driver(
3384
3391
else :
3385
3392
if selenium4_or_newer :
3386
3393
service = ChromeService (
3394
+ log_output = os .devnull ,
3387
3395
service_args = ["--disable-build-check" ],
3388
3396
)
3389
3397
driver = webdriver .Chrome (
@@ -3420,7 +3428,10 @@ def get_local_driver(
3420
3428
elif "Missing or invalid capabilities" in e .msg :
3421
3429
if selenium4_or_newer :
3422
3430
chrome_options .add_experimental_option ("w3c" , True )
3423
- service = ChromeService (log_output = os .devnull )
3431
+ service = ChromeService (
3432
+ log_output = os .devnull ,
3433
+ service_args = ["--disable-build-check" ],
3434
+ )
3424
3435
with warnings .catch_warnings ():
3425
3436
warnings .simplefilter (
3426
3437
"ignore" , category = DeprecationWarning
@@ -3467,6 +3478,7 @@ def get_local_driver(
3467
3478
try :
3468
3479
if selenium4_or_newer :
3469
3480
service = ChromeService (
3481
+ log_output = os .devnull ,
3470
3482
service_args = ["--disable-build-check" ],
3471
3483
)
3472
3484
return webdriver .Chrome (
@@ -3488,11 +3500,20 @@ def get_local_driver(
3488
3500
)
3489
3501
if "--headless" in chrome_options .arguments :
3490
3502
chrome_options .arguments .remove ("--headless" )
3491
- return webdriver .Chrome (options = chrome_options )
3503
+ service = ChromeService (
3504
+ log_output = os .devnull ,
3505
+ service_args = ["--disable-build-check" ]
3506
+ )
3507
+ return webdriver .Chrome (
3508
+ service = service , options = chrome_options
3509
+ )
3492
3510
except Exception :
3493
3511
try :
3494
3512
# Try again if Chrome didn't launch
3495
- return webdriver .Chrome (options = chrome_options )
3513
+ service = ChromeService (service_args = ["--disable-build-check" ])
3514
+ return webdriver .Chrome (
3515
+ service = service , options = chrome_options
3516
+ )
3496
3517
except Exception :
3497
3518
pass
3498
3519
if headless :
@@ -3505,7 +3526,11 @@ def get_local_driver(
3505
3526
"\n Warning: Could not make chromedriver"
3506
3527
" executable: %s" % e
3507
3528
)
3508
- return webdriver .Chrome ()
3529
+ service = ChromeService (
3530
+ log_output = os .devnull ,
3531
+ service_args = ["--disable-build-check" ]
3532
+ )
3533
+ return webdriver .Chrome (service = service )
3509
3534
else :
3510
3535
raise Exception (
3511
3536
"%s is not a valid browser option for this system!" % browser_name
0 commit comments