20
20
from seleniumbase import extensions # browser extensions storage folder
21
21
urllib3 .disable_warnings ()
22
22
DRIVER_DIR = os .path .dirname (os .path .realpath (drivers .__file__ ))
23
+ if DRIVER_DIR not in os .environ ["PATH" ]:
24
+ os .environ ["PATH" ] += os .pathsep + DRIVER_DIR
23
25
EXTENSIONS_DIR = os .path .dirname (os .path .realpath (extensions .__file__ ))
24
26
DISABLE_CSP_ZIP_PATH = "%s/%s" % (EXTENSIONS_DIR , "disable_csp.zip" )
25
27
PROXY_ZIP_PATH = proxy_helper .PROXY_ZIP_PATH
@@ -464,16 +466,10 @@ def get_local_driver(
464
466
options .add_argument ('-headless' )
465
467
if LOCAL_GECKODRIVER and os .path .exists (LOCAL_GECKODRIVER ):
466
468
make_driver_executable_if_not (LOCAL_GECKODRIVER )
467
- firefox_driver = webdriver .Firefox (
468
- firefox_profile = profile ,
469
- capabilities = firefox_capabilities ,
470
- options = options ,
471
- executable_path = LOCAL_GECKODRIVER )
472
- else :
473
- firefox_driver = webdriver .Firefox (
474
- firefox_profile = profile ,
475
- capabilities = firefox_capabilities ,
476
- options = options )
469
+ firefox_driver = webdriver .Firefox (
470
+ firefox_profile = profile ,
471
+ capabilities = firefox_capabilities ,
472
+ options = options )
477
473
except WebDriverException :
478
474
# Don't use Geckodriver: Only works for old versions of Firefox
479
475
profile = _create_firefox_profile (
@@ -502,11 +498,7 @@ def get_local_driver(
502
498
ie_capabilities = ie_options .to_capabilities ()
503
499
if LOCAL_IEDRIVER and os .path .exists (LOCAL_IEDRIVER ):
504
500
make_driver_executable_if_not (LOCAL_IEDRIVER )
505
- return webdriver .Ie (
506
- capabilities = ie_capabilities ,
507
- executable_path = LOCAL_IEDRIVER )
508
- else :
509
- return webdriver .Ie (capabilities = ie_capabilities )
501
+ return webdriver .Ie (capabilities = ie_capabilities )
510
502
elif browser_name == constants .Browser .EDGE :
511
503
if LOCAL_EDGEDRIVER and os .path .exists (LOCAL_EDGEDRIVER ):
512
504
make_driver_executable_if_not (LOCAL_EDGEDRIVER )
@@ -525,9 +517,7 @@ def get_local_driver(
525
517
elif browser_name == constants .Browser .OPERA :
526
518
if LOCAL_OPERADRIVER and os .path .exists (LOCAL_OPERADRIVER ):
527
519
make_driver_executable_if_not (LOCAL_OPERADRIVER )
528
- return webdriver .Opera (executable_path = LOCAL_OPERADRIVER )
529
- else :
530
- return webdriver .Opera ()
520
+ return webdriver .Opera ()
531
521
elif browser_name == constants .Browser .PHANTOM_JS :
532
522
with warnings .catch_warnings ():
533
523
# Ignore "PhantomJS has been deprecated" UserWarning
@@ -542,18 +532,13 @@ def get_local_driver(
542
532
extension_zip , extension_dir )
543
533
if LOCAL_CHROMEDRIVER and os .path .exists (LOCAL_CHROMEDRIVER ):
544
534
make_driver_executable_if_not (LOCAL_CHROMEDRIVER )
545
- return webdriver .Chrome (
546
- executable_path = LOCAL_CHROMEDRIVER , options = chrome_options )
547
- else :
548
- return webdriver .Chrome (options = chrome_options )
535
+ return webdriver .Chrome (options = chrome_options )
549
536
except Exception as e :
550
537
if headless :
551
538
raise Exception (e )
552
539
if LOCAL_CHROMEDRIVER and os .path .exists (LOCAL_CHROMEDRIVER ):
553
540
make_driver_executable_if_not (LOCAL_CHROMEDRIVER )
554
- return webdriver .Chrome (executable_path = LOCAL_CHROMEDRIVER )
555
- else :
556
- return webdriver .Chrome ()
541
+ return webdriver .Chrome ()
557
542
else :
558
543
raise Exception (
559
544
"%s is not a valid browser option for this system!" % browser_name )
0 commit comments