How to add chromedriver to Path in ubuntu?

I have tried to add the path of chrome driver in Ubuntu 18.04LTS.

  1. How do I put chromedriver in PATH

its located at

/home/<usr>/Documents/Python/chromedriver

in my laptop

can any one help me with the solution for this?

Thanks in advance.

1 Answer

After you downloaded und extracted ChromeDriver you have three options.

  • A) Save the file in a directory which is already in PATH

  • B) Save the file at a custom location and add it to PATH

  • C) Save the file at a custom location and create a symlink to the file in one of the directories that are already in PATH

For the following examples let's assume the extracted file is in ~/Downloads

Example to A)

// Move file to a directory that's already in PATH
sudo mv ~/Downloads/chromedriver /usr/local/bin
// Make file executable
sudo chmod +x /usr/local/bin/chromedriver

Example to B)

// Move file to a directory that's not in PATH
mv ~/Downloads/chromedriver ~/Documents/Python/ChromeDriver/
// Make file executable
chmod +x ~/Documents/Python/ChromeDriver/chromedriver
// Add directory to PATH
echo 'export PATH="$HOME/Documents/Python/ChromeDriver:$PATH"' >> ~/.profile
source ~/.profile

Example to C)

// Move file to a directory that's not in PATH
mv ~/Downloads/chromedriver ~/Documents/Python/ChromeDriver/
// Make file executable
chmod +x ~/Documents/Python/ChromeDriver/chromedriver
// Create a symlink to 'chromedriver' in one of the directories
// that are already in PATH (e.g. /usr/bin or /usr/local/bin)
sudo ln -s ~/Documents/Python/ChromeDriver/chromedriver /usr/bin/chromedriver

I hope i could make it clear.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like