The “chrome driver executable needs to be available in the path” error typically occurs when the ChromeDriver executable file is not in a directory listed in the system’s PATH environment variable. The PATH variable is a list of directories that the operating system searches for executable files.
To resolve this error, you can follow these steps:
- Download the ChromeDriver executable file: Visit the official ChromeDriver website (https://sites.google.com/a/chromium.org/chromedriver/) and download the appropriate version of ChromeDriver for your operating system.
- For a more detailed guide, please refer to: Steps for Chrome driver download and installation.
- Move the ChromeDriver executable to a directory in the system’s PATH: After downloading the ChromeDriver executable, you need to move it to a directory included in the PATH variable. The specific steps for doing this can vary depending on your operating system.
- Windows FIX:
- Place the ChromeDriver executable in a directory such as C:\Windows or C:\Windows\System32.
- Alternatively, you can create a new directory (e.g., C:\chromedriver) and add that directory to the PATH variable.
- FIX for macOS / Linux:
- Move the ChromeDriver executable to a directory such as /usr/local/bin or /usr/bin.
- You can also create a new directory and add it to the PATH variable in the shell configuration file
- ~/.bashrc, ~/.bash_profile, or ~/.zshrc
- Read more on .bashrc editing here: Bashrc Alias, what is it and how to use it?
- Open a terminal and use a text editor to modify the shell configuration file (e.g: vim /.bashrc )
- Add the following line at the end of the file: export PATH=”/path/to/directory:$PATH”.
- Save the file and exit the text editor.
- Run source ~/.bashrc (or the appropriate file) to apply the changes.
- Verify the ChromeDriver installation: Open a new terminal or command prompt window and run the following command to verify that ChromeDriver is now accessible from the command line:
If you see the version information of ChromeDriver printed on the console, it means the installation was successful.
By following these steps, you should be able to resolve the “Chromedriver executable needs to be available in the path” error and use ChromeDriver successfully in your applications or automation scripts.
What is WebDriver?
WebDriver is a web automation framework that allows developers to automate the testing of web applications across different browsers and platforms. It provides a programming interface to interact with web browsers and control their behaviour programmatically. WebDriver is commonly used with testing frameworks to create automated tests for web applications.