Skip to content

Commit 842deb6

Browse files
authored
Merge pull request #1614 from seleniumbase/refactoring-and-removing-old-drivers
Refactoring and removing deprecated drivers
2 parents 0d4930e + e0fe593 commit 842deb6

File tree

18 files changed

+60
-155
lines changed

18 files changed

+60
-155
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ install:
2121
- "sudo rm -f /etc/boto.cfg"
2222
before_script:
2323
- "flake8 --exclude=temp"
24-
# - "wget https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin/ && sudo chmod +x /usr/local/bin/chromedriver"
25-
# - "wget https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz -O /tmp/geckodriver.tar.gz && tar -C /opt -xzf /tmp/geckodriver.tar.gz && sudo chmod 755 /opt/geckodriver && sudo ln -fs /opt/geckodriver /usr/bin/geckodriver && sudo ln -fs /opt/geckodriver /usr/local/bin/geckodriver"
26-
# - "wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && tar -xvf ./phantomjs-2.1.1-linux-x86_64.tar.bz2 && export PATH=$PWD/phantomjs-2.1.1-linux-x86_64/bin:$PATH"
24+
# - "wget https://chromedriver.storage.googleapis.com/72.0.3626.69/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin/ && sudo chmod +x /usr/local/bin/chromedriver"
25+
# - "wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz -O /tmp/geckodriver.tar.gz && tar -C /opt -xzf /tmp/geckodriver.tar.gz && sudo chmod 755 /opt/geckodriver && sudo ln -fs /opt/geckodriver /usr/bin/geckodriver && sudo ln -fs /opt/geckodriver /usr/local/bin/geckodriver"
2726
- "seleniumbase"
2827
- "seleniumbase install chromedriver"
2928
# - "seleniumbase install geckodriver"

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ RUN cd /SeleniumBase && pip3 install .
8888
#=====================
8989
# Download WebDrivers
9090
#=====================
91-
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
92-
RUN tar -xvzf geckodriver-v0.31.0-linux64.tar.gz
91+
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz
92+
RUN tar -xvzf geckodriver-v0.32.0-linux64.tar.gz
9393
RUN chmod +x geckodriver
9494
RUN mv geckodriver /usr/local/bin/
9595
RUN wget https://chromedriver.storage.googleapis.com/72.0.3626.69/chromedriver_linux64.zip

examples/pure_python.py renamed to examples/raw_call.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Running tests with pure "python" instead of directly calling "pytest".
2-
To run, use: "python pure_python.py".
1+
"""Calling tests with "python" instead of directly using "pytest".
2+
To run, use: "python raw_call.py".
33
Two examples: pytest.main() and subprocess.call()."""
44
import pytest
55
import subprocess

help_docs/webdriver_installation.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,50 @@
11
<!-- SeleniumBase Docs -->
22

3-
## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Installing webdrivers
3+
## [<img src="https://seleniumbase.github.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Installing webdrivers
44

55
To run web automation, you'll need webdrivers for each browser you plan on using. With SeleniumBase, drivers are downloaded automatically as needed into the SeleniumBase ``drivers`` folder.
66

77
You can also download drivers manually with these commands:
88

99
```bash
10-
sbase get chromedriver
11-
sbase get geckodriver
12-
sbase get edgedriver
10+
seleniumbase get chromedriver
11+
seleniumbase get geckodriver
12+
seleniumbase get edgedriver
1313
```
1414

15-
* To get the latest ``chromedriver`` when you don't have the latest Chrome, use:
15+
After running the commands above, web drivers will get downloaded into the ``seleniumbase/drivers/`` folder. SeleniumBase uses those drivers during tests. (The drivers don't come with SeleniumBase by default.)
1616

17-
```bash
18-
sbase get chromedriver latest
19-
```
17+
If the necessary driver is not found in this location while running tests, SeleniumBase will instead look for the driver on the System PATH. If the necessary driver is not on the System PATH either, SeleniumBase will automatically attempt to download the required driver.
2018

21-
* You can also get a specific version of chromedriver for a specific version of Chrome:
19+
* You can also download specific versions of drivers. Examples:
2220

2321
```bash
24-
sbase get chromedriver 107.0.5304.62
25-
2622
sbase get chromedriver 107
23+
sbase get chromedriver 107.0.5304.62
24+
sbase get chromedriver latest
25+
sbase get chromedriver latest-1
26+
sbase get edgedriver 106.0.1370.42
2727
```
2828

29-
* On Linux, you can run the following two commands (once you've installed SeleniumBase) to automatically upgrade your Chromedriver to match your version of Chrome: (``wget`` downloads the file, and ``pytest`` runs it.)
29+
(NOTE: ``sbase`` is a shortcut for ``seleniumbase``)
3030

31-
```bash
32-
wget https://raw.githubusercontent.com/seleniumbase/SeleniumBase/master/examples/upgrade_chromedriver.py
33-
pytest upgrade_chromedriver.py -s
34-
```
31+
--------
3532

36-
* If you run a test without the correct webdriver available, the driver will be downloaded automatically.
37-
38-
If you plan on using the [Selenium Grid integration](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md) (which allows for remote webdriver), you'll need to put the drivers on your System PATH. On macOS and Linux, ``/usr/local/bin`` is a good PATH spot. On Windows, you may need to set the System PATH under Environment Variables to include the location where you placed the driver files. As a shortcut, you could place the driver files into your Python ``Scripts/`` folder in the location where you have Python installed, which should already be on your System PATH.
33+
If you plan on using the [Selenium Grid integration](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md) (which allows for ``remote`` webdriver), you'll need to put the drivers on your System PATH. On macOS and Linux, ``/usr/local/bin`` is a good PATH spot. On Windows, you may need to set the System PATH under Environment Variables to include the location where you placed the driver files. As a shortcut, you could place the driver files into your Python ``Scripts/`` folder in the location where you have Python installed, which should already be on your System PATH.
3934

4035
Here's where you can go to manually get web drivers from the source:
4136

4237
* For Chrome, get [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/downloads) on your System PATH.
4338

44-
* For Firefox, get [Geckodriver](https://github.com/mozilla/geckodriver/releases) on your System PATH.
39+
* For Edge, get [Edge Driver (Microsoft WebDriver)](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) on your System PATH.
4540

46-
* For Microsoft Edge, get [Edge Driver (Microsoft WebDriver)](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) on your System PATH.
41+
* For Firefox, get [Geckodriver](https://github.com/mozilla/geckodriver/releases) on your System PATH.
4742

4843
* For Safari, get [Safari Driver](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/using_safari_driver.md) on your System PATH.
4944

50-
* For Opera, get [Opera Chromium Driver](https://github.com/operasoftware/operachromiumdriver/releases) on your System PATH..
51-
52-
* For PhantomJS headless browser automation, get [PhantomJS](http://phantomjs.org/download.html) on your System PATH. (NOTE: <i>PhantomJS is no longer officially supported by SeleniumHQ</i>)
53-
5445
**macOS shortcuts**:
5546

56-
* You can also install drivers by using ``brew`` (aka ``homebrew``), but you'll need to install that first. [Brew installation instructions are here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/install_python_pip_git.md).
47+
* You can also install drivers by using ``brew`` (aka ``homebrew``):
5748

5849
```bash
5950
brew install --cask chromedriver
@@ -71,7 +62,7 @@ brew upgrade geckodriver
7162

7263
**Linux shortcuts**:
7364

74-
If you still need the web drivers, here are some scripts to help you get chromedriver and geckodriver on a Linux machine:
65+
If you still need the web drivers, here are some scripts to help you get ``chromedriver`` and ``geckodriver`` on a Linux machine:
7566

7667
```bash
7768
wget https://chromedriver.storage.googleapis.com/72.0.3626.69/chromedriver_linux64.zip
@@ -87,6 +78,6 @@ mv geckodriver /usr/local/bin/
8778
chmod +x /usr/local/bin/geckodriver
8879
```
8980

90-
* If you wish to verify that web drivers are working, **[follow these instructions](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/verify_webdriver.md)**.
81+
To verify that web drivers are working, **[follow these instructions](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/verify_webdriver.md)**.
9182

92-
[<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="280">](https://github.com/seleniumbase/SeleniumBase)
83+
[<img src="https://seleniumbase.github.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="280">](https://github.com/seleniumbase/SeleniumBase)

integrations/linux/Linuxfile.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ sudo apt-get install -y --force-yes libmysqlclient-dev
6161
sudo apt-get install -y --force-yes python-dev
6262
sudo apt-get install -y --force-yes python-MySQLdb
6363

64-
# Install PhantomJS
65-
# cd ~
66-
# export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
67-
# sudo wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
68-
# sudo tar xvjf $PHANTOM_JS.tar.bz2
69-
# sudo mv -f $PHANTOM_JS /usr/local/share
70-
# sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
71-
7264
# Install Chrome
7365
cd /tmp
7466
sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.8.5"
2+
__version__ = "4.8.6"

seleniumbase/behave/behave_sb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
behave -D agent="User Agent String" -D demo
99
****************************************************************
1010
-D browser=BROWSER (The web browser to use. Default: "chrome".)
11-
-D chrome (Shortcut for "-D browser=chrome". On by default.)
11+
-D chrome (Shortcut for "-D browser=chrome". Default.)
1212
-D edge (Shortcut for "-D browser=edge".)
1313
-D firefox (Shortcut for "-D browser=firefox".)
1414
-D safari (Shortcut for "-D browser=safari".)

seleniumbase/core/browser_launcher.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,44 +1633,6 @@ def get_remote_driver(
16331633
desired_capabilities=capabilities,
16341634
keep_alive=True,
16351635
)
1636-
elif browser_name == constants.Browser.PHANTOM_JS:
1637-
if selenium4_or_newer:
1638-
message = (
1639-
"\n"
1640-
"PhantomJS is no longer available for Selenium 4!\n"
1641-
'Try using "--headless" mode with Chrome instead!'
1642-
)
1643-
raise Exception(message)
1644-
capabilities = webdriver.DesiredCapabilities.PHANTOMJS
1645-
for key in desired_caps.keys():
1646-
capabilities[key] = desired_caps[key]
1647-
with warnings.catch_warnings():
1648-
# Ignore "PhantomJS has been deprecated" UserWarning
1649-
warnings.simplefilter("ignore", category=UserWarning)
1650-
return webdriver.Remote(
1651-
command_executor=address,
1652-
desired_capabilities=capabilities,
1653-
keep_alive=True,
1654-
)
1655-
elif browser_name == constants.Browser.ANDROID:
1656-
capabilities = webdriver.DesiredCapabilities.ANDROID
1657-
if selenium4_or_newer:
1658-
remote_options = ArgOptions()
1659-
remote_options.set_capability("cloud:options", desired_caps)
1660-
return webdriver.Remote(
1661-
command_executor=address,
1662-
options=remote_options,
1663-
keep_alive=True,
1664-
)
1665-
else:
1666-
warnings.simplefilter("ignore", category=DeprecationWarning)
1667-
for key in desired_caps.keys():
1668-
capabilities[key] = desired_caps[key]
1669-
return webdriver.Remote(
1670-
command_executor=address,
1671-
desired_capabilities=capabilities,
1672-
keep_alive=True,
1673-
)
16741636
elif browser_name == constants.Browser.IPHONE:
16751637
capabilities = webdriver.DesiredCapabilities.IPHONE
16761638
if selenium4_or_newer:
@@ -2412,18 +2374,6 @@ def get_local_driver(
24122374
except Exception:
24132375
# Opera support was dropped! Downgrade to Python 3.6 to use it!
24142376
return webdriver.Opera()
2415-
elif browser_name == constants.Browser.PHANTOM_JS:
2416-
if selenium4_or_newer:
2417-
message = (
2418-
"\n"
2419-
"PhantomJS is no longer available for Selenium 4!\n"
2420-
'Try using "--headless" mode with Chrome instead!'
2421-
)
2422-
raise Exception(message)
2423-
with warnings.catch_warnings():
2424-
# Ignore "PhantomJS has been deprecated" UserWarning
2425-
warnings.simplefilter("ignore", category=UserWarning)
2426-
return webdriver.PhantomJS()
24272377
elif browser_name == constants.Browser.GOOGLE_CHROME:
24282378
try:
24292379
chrome_options = _set_chrome_options(

seleniumbase/drivers/ReadMe.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
### <img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> SeleniumBase webdriver storage
1+
### <img src="https://seleniumbase.github.io/img/logo6.png" title="SeleniumBase" width="32" /> SeleniumBase webdriver storage
22

3-
* You need a different webdriver for each web browser you want to run automation on: ``chromedriver`` for Chrome, ``edgedriver`` for Edge, ``geckodriver`` for Firefox, ``operadriver`` for Opera, and ``iedriver`` for Internet Explorer.
3+
To run web automation, you'll need webdrivers for each browser you plan on using. With SeleniumBase, drivers are downloaded automatically as needed into the SeleniumBase ``drivers`` folder.
4+
5+
You can also download drivers manually with these commands:
46

57
```bash
68
seleniumbase get chromedriver
79
seleniumbase get geckodriver
810
seleniumbase get edgedriver
9-
seleniumbase get iedriver
10-
seleniumbase get operadriver
1111
```
1212

13-
After running the commands above, web drivers will get downloaded into this folder. SeleniumBase will then use those drivers during tests if present. (The drivers don't come with SeleniumBase by default.)
14-
15-
* If you have the latest version of Chrome installed, get the latest chromedriver (<i>otherwise it defaults to chromedriver 72.0.3626.69 for compatibility reasons</i>):
16-
17-
```bash
18-
sbase get chromedriver latest
19-
```
13+
After running the commands above, web drivers will get downloaded into the ``seleniumbase/drivers/`` folder. SeleniumBase uses those drivers during tests. (The drivers don't come with SeleniumBase by default.)
2014

2115
If the necessary driver is not found in this location while running tests, SeleniumBase will instead look for the driver on the System PATH. If the necessary driver is not on the System PATH either, SeleniumBase will automatically attempt to download the required driver.
2216

2317
* You can also download specific versions of drivers. Examples:
2418

2519
```bash
26-
sbase get chromedriver 101
27-
sbase get chromedriver 101.0.4951.41
20+
sbase get chromedriver 107
21+
sbase get chromedriver 107.0.5304.62
22+
sbase get chromedriver latest
2823
sbase get chromedriver latest-1
29-
sbase get edgedriver 101.0.1210.32
24+
sbase get edgedriver 106.0.1370.42
3025
```
26+
27+
(NOTE: ``sbase`` is a shortcut for ``seleniumbase``)

seleniumbase/fixtures/constants.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,7 @@ class ValidBrowsers:
310310
"firefox",
311311
"ie",
312312
"opera",
313-
"phantomjs",
314313
"safari",
315-
"android",
316314
"iphone",
317315
"ipad",
318316
"remote",
@@ -325,9 +323,7 @@ class Browser:
325323
FIREFOX = "firefox"
326324
INTERNET_EXPLORER = "ie"
327325
OPERA = "opera"
328-
PHANTOM_JS = "phantomjs"
329326
SAFARI = "safari"
330-
ANDROID = "android"
331327
IPHONE = "iphone"
332328
IPAD = "ipad"
333329
REMOTE = "remote"
@@ -338,9 +334,7 @@ class Browser:
338334
"firefox": None,
339335
"ie": None,
340336
"opera": None,
341-
"phantomjs": None,
342337
"safari": None,
343-
"android": None,
344338
"iphone": None,
345339
"ipad": None,
346340
"remote": None,
@@ -352,9 +346,7 @@ class Browser:
352346
"firefox": None,
353347
"ie": None,
354348
"opera": None,
355-
"phantomjs": None,
356349
"safari": None,
357-
"android": None,
358350
"iphone": None,
359351
"ipad": None,
360352
"remote": None,

0 commit comments

Comments
 (0)