SeleniumBase/help_docs/webdriver_installation.md

82 lines
3.6 KiB
Markdown
Raw Normal View History

2022-11-05 13:27:22 +08:00
<!-- SeleniumBase Docs -->
2022-11-19 03:17:56 +08:00
## [<img src="https://seleniumbase.github.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Installing webdrivers
2017-11-02 02:09:00 +08:00
2022-08-06 06:27:38 +08:00
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.
2017-10-31 09:59:24 +08:00
2022-08-06 06:27:38 +08:00
You can also download drivers manually with these commands:
2018-08-01 02:47:10 +08:00
```bash
2022-11-19 03:17:56 +08:00
seleniumbase get chromedriver
seleniumbase get geckodriver
seleniumbase get edgedriver
2018-08-01 02:47:10 +08:00
```
2021-01-28 00:54:19 +08:00
2022-11-19 03:17:56 +08:00
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.)
2021-01-28 00:54:19 +08:00
2022-11-19 03:17:56 +08:00
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.
2021-01-28 00:54:19 +08:00
2022-11-19 03:17:56 +08:00
* You can also download specific versions of drivers. Examples:
2021-01-28 00:54:19 +08:00
2020-06-08 01:41:56 +08:00
```bash
sbase get chromedriver 114
sbase get chromedriver 114.0.5735.90
2023-08-01 03:03:44 +08:00
sbase get edgedriver 115.0.1901.183
2020-06-08 01:41:56 +08:00
```
2018-08-01 02:47:10 +08:00
2022-11-19 03:17:56 +08:00
(NOTE: ``sbase`` is a shortcut for ``seleniumbase``)
2021-10-21 10:40:56 +08:00
2022-11-19 03:17:56 +08:00
--------
2021-10-21 10:40:56 +08:00
2022-11-19 03:17:56 +08:00
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.
2018-08-01 02:47:10 +08:00
2022-09-02 04:27:34 +08:00
Here's where you can go to manually get web drivers from the source:
2017-10-31 09:59:24 +08:00
2018-03-26 09:07:05 +08:00
* For Chrome, get [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/downloads) on your System PATH.
2017-10-31 09:59:24 +08:00
2022-11-19 03:17:56 +08:00
* For Edge, get [Edge Driver (Microsoft WebDriver)](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) on your System PATH.
2017-10-31 09:59:24 +08:00
2022-11-19 03:17:56 +08:00
* For Firefox, get [Geckodriver](https://github.com/mozilla/geckodriver/releases) on your System PATH.
2017-10-31 09:59:24 +08:00
2018-03-26 09:07:05 +08:00
* For Safari, get [Safari Driver](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/using_safari_driver.md) on your System PATH.
2017-10-31 09:59:24 +08:00
2020-05-13 07:21:55 +08:00
**macOS shortcuts**:
2017-10-31 09:59:24 +08:00
2022-11-19 03:17:56 +08:00
* You can also install drivers by using ``brew`` (aka ``homebrew``):
2017-10-31 09:59:24 +08:00
```bash
2022-08-16 07:28:53 +08:00
brew install --cask chromedriver
2018-03-09 08:28:23 +08:00
brew install geckodriver
2017-10-31 09:59:24 +08:00
```
2020-05-13 07:21:55 +08:00
You can also upgrade existing webdrivers:
2017-10-31 09:59:24 +08:00
```bash
2022-08-16 07:28:53 +08:00
brew upgrade --cask chromedriver
2018-03-09 08:28:23 +08:00
brew upgrade geckodriver
2017-10-31 09:59:24 +08:00
```
2020-05-13 07:21:55 +08:00
**Linux shortcuts**:
2018-02-14 05:03:36 +08:00
2022-11-19 03:17:56 +08:00
If you still need the web drivers, here are some scripts to help you get ``chromedriver`` and ``geckodriver`` on a Linux machine:
2018-08-01 02:47:10 +08:00
2018-02-14 05:03:36 +08:00
```bash
2022-07-09 05:02:17 +08:00
wget https://chromedriver.storage.googleapis.com/72.0.3626.69/chromedriver_linux64.zip
2018-02-14 05:03:36 +08:00
unzip chromedriver_linux64.zip
mv chromedriver /usr/local/bin/
chmod +x /usr/local/bin/chromedriver
```
```bash
2023-04-22 02:58:40 +08:00
wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
tar xvfz geckodriver-v0.33.0-linux64.tar.gz
2018-02-14 05:03:36 +08:00
mv geckodriver /usr/local/bin/
chmod +x /usr/local/bin/geckodriver
```
2022-11-19 03:17:56 +08:00
To verify that web drivers are working, **[follow these instructions](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/verify_webdriver.md)**.
2022-08-06 06:27:38 +08:00
2022-11-19 03:17:56 +08:00
[<img src="https://seleniumbase.github.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="280">](https://github.com/seleniumbase/SeleniumBase)