Download chromedriver binary and add to your PATH for automated functional testing
Published: 2018-09-19 • Last updated: 2021-01-08
Table of Contents
Many automated functional testing projects these days rely on chromedriver as the main driver. Below are steps for Mac and Windows to download it, add it to your PATH
, and verify setup.
You can obviously place the chromedriver binary in any directory you like, I just used Mac ${HOME}/bin
and Windows C:\bin
for this example.
# Mac
# Via CLI
- Create directory
${HOME}/bin
- Download chromedriver for Mac and save to
${HOME}/bin
cd ${HOME}/bin && chmod +x chromedriver
to make it executable- Open
${HOME}/.bash_profile
in a text editor - Add line
export PATH="${PATH}:${HOME}/bin"
then save the file - Restart your terminal
- Verify setup with
chromedriver -v
# Windows
# Via CLI
- Create directory
C:\bin
- Download chromedriver for Windows and save to
C:\bin
- Open Command Prompt and set the
PATH
for your accountsetx PATH "%PATH%;C:\bin"
- RESTART Command Prompt. Changes made by
setx
will only be picked up in new instances of Command Prompt - Verify setup with
chromedriver.exe -v
# Via GUI
- Create directory
C:\bin
- Download chromedriver for Windows and save to
C:\bin
- Add directory to your
PATH
: - Depending on your Windows version:
- If you’re using Windows 8 or 10, press the Windows key, then search for and select System (Control Panel)
- If you’re using Windows 7, right click the Computer icon on the desktop and click Properties
- Click Advanced system settings
- Click Environment Variables
- Under System Variables, find the
PATH
variable, select it, and click Edit. If there is noPATH
variable, click New - Add
C:\bin
to the end of the variable value, preceeded by a;
. For example, if the value wasC:\Windows\System32
, change it toC:\Windows\System32;C:\bin
- Click OK
- Restart your command prompt
- Verify setup with
chromedriver.exe -v