Where is my chromedriver?!
A quick guide to setting up your chromedriver so you can use it from anywhere in the terminal without specifying the full path.
Table of contents
No headings in the article.
Anyone getting frustrated with finding your chromedriver every time you're using Selenium in a Python script?
Perhaps you should add your ChromeDriver to the System PATH on your macOS. Just follow these steps:
Open a Terminal: Go to "Applications" > "Utilities" > "Terminal" to open a new terminal window.
Locate the ChromeDriver Executable: After downloading ChromeDriver, find the location where the executable file is located. Typically, it's a single file named "chromedriver" without any file extension.
Determine a Suitable Directory: Decide on a directory where you want to place the ChromeDriver executable. A common choice is "/usr/local/bin", which is already included in the default System PATH on macOS.
Copy the ChromeDriver Executable: Use the "cp" command to copy the ChromeDriver executable to the chosen directory. For example, if you downloaded ChromeDriver to your "Downloads" folder, and you want to copy it to "/usr/local/bin", you can use the following command (replace the paths accordingly):
sudo cp /path/to/chromedriver /usr/local/bin
Note: The "sudo" command is used to gain administrator privileges since copying to "/usr/local/bin" requires administrative access.
Enter Your Password: When prompted, enter your macOS user password. This is required because the "sudo" command is used to copy the file to a system directory.
Verify Installation: To verify that ChromeDriver is in the System PATH, you can use the "which" command to check its location. In the terminal, type:
which chromedriver
If ChromeDriver is correctly installed in the System PATH, the terminal should display its path (e.g., "/usr/local/bin/chromedriver").
Restart the Terminal: To apply the changes to the System PATH, restart your terminal window. Once the terminal is restarted, you can use "chromedriver" from anywhere in the terminal without specifying the full path.
After completing these steps, you should have ChromeDriver added to the System PATH on your macOS. This allows you to use Selenium WebDriver with ChromeDriver in your C# project without any issues.