Skip to content

Commit f41e60f

Browse files
authored
Merge pull request #383 from seleniumbase/driver-path
Selenium 4 compatibility
2 parents 25fe26f + e829241 commit f41e60f

File tree

3 files changed

+14
-34
lines changed

3 files changed

+14
-34
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_3j.png" title="SeleniumBase" align="center" height="45">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
1+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_3k.png" title="SeleniumBase" align="center" height="45">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

33
[<img src="https://img.shields.io/github/release/seleniumbase/SeleniumBase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/releases) [<img src="https://dev.azure.com/seleniumbase/seleniumbase/_apis/build/status/seleniumbase.SeleniumBase?branchName=master" alt=" " />](https://dev.azure.com/seleniumbase/seleniumbase/_build/latest?definitionId=1&branchName=master) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt=" " />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt=" " />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/stargazers)<br />
44

@@ -27,19 +27,13 @@ To isolate **``python``** dependencies between projects, you can create a Virtua
2727
```bash
2828
pip install seleniumbase
2929
```
30-
* Add ``--upgrade`` to upgrade an existing installation.
30+
* Add ``--upgrade`` OR ``-U`` to upgrade an installation.
3131
* Add ``--force-reinstall`` for a clean install.
3232

3333
You can also install seleniumbase from a ``git clone``:
3434
```bash
3535
git clone https://github.com/seleniumbase/SeleniumBase.git
3636
cd SeleniumBase
37-
pip install .
38-
```
39-
40-
To install dependancies separately from seleniumbase:
41-
(From the ``SeleniumBase`` folder:)
42-
```bash
4337
pip install -r requirements.txt
4438
python setup.py install
4539
```

seleniumbase/core/browser_launcher.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from seleniumbase import extensions # browser extensions storage folder
2121
urllib3.disable_warnings()
2222
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
2325
EXTENSIONS_DIR = os.path.dirname(os.path.realpath(extensions.__file__))
2426
DISABLE_CSP_ZIP_PATH = "%s/%s" % (EXTENSIONS_DIR, "disable_csp.zip")
2527
PROXY_ZIP_PATH = proxy_helper.PROXY_ZIP_PATH
@@ -464,16 +466,10 @@ def get_local_driver(
464466
options.add_argument('-headless')
465467
if LOCAL_GECKODRIVER and os.path.exists(LOCAL_GECKODRIVER):
466468
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)
477473
except WebDriverException:
478474
# Don't use Geckodriver: Only works for old versions of Firefox
479475
profile = _create_firefox_profile(
@@ -502,11 +498,7 @@ def get_local_driver(
502498
ie_capabilities = ie_options.to_capabilities()
503499
if LOCAL_IEDRIVER and os.path.exists(LOCAL_IEDRIVER):
504500
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)
510502
elif browser_name == constants.Browser.EDGE:
511503
if LOCAL_EDGEDRIVER and os.path.exists(LOCAL_EDGEDRIVER):
512504
make_driver_executable_if_not(LOCAL_EDGEDRIVER)
@@ -525,9 +517,7 @@ def get_local_driver(
525517
elif browser_name == constants.Browser.OPERA:
526518
if LOCAL_OPERADRIVER and os.path.exists(LOCAL_OPERADRIVER):
527519
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()
531521
elif browser_name == constants.Browser.PHANTOM_JS:
532522
with warnings.catch_warnings():
533523
# Ignore "PhantomJS has been deprecated" UserWarning
@@ -542,18 +532,13 @@ def get_local_driver(
542532
extension_zip, extension_dir)
543533
if LOCAL_CHROMEDRIVER and os.path.exists(LOCAL_CHROMEDRIVER):
544534
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)
549536
except Exception as e:
550537
if headless:
551538
raise Exception(e)
552539
if LOCAL_CHROMEDRIVER and os.path.exists(LOCAL_CHROMEDRIVER):
553540
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()
557542
else:
558543
raise Exception(
559544
"%s is not a valid browser option for this system!" % browser_name)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.32.6',
48+
version='1.32.7',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',
@@ -78,6 +78,7 @@
7878
"Programming Language :: Python :: 3.5",
7979
"Programming Language :: Python :: 3.6",
8080
"Programming Language :: Python :: 3.7",
81+
"Programming Language :: Python :: 3.8",
8182
],
8283
install_requires=[
8384
'pip',

0 commit comments

Comments
 (0)