Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save farhad0085/be1e9056db405b934a54563366e781b8 to your computer and use it in GitHub Desktop.

Select an option

Save farhad0085/be1e9056db405b934a54563366e781b8 to your computer and use it in GitHub Desktop.
Setup Selenium Chromedriver (Python) in Ubuntu

Setup Selenium Chromedriver (Python) in Ubuntu

Step 1: Install Google Chrome

  1. Downloading Google Chrome

    Use wget to download the latest Google Chrome .deb package :

    sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  2. Installing Google Chrome

    Installing packages on Ubuntu requires administrative privileges. Running the following command as a user with sudo privileges to install Chrome .deb package on your system:

    sudo apt install ./google-chrome-stable_current_amd64.deb

    When prompted, enter your user password, and the installation will start. At this point, you have Chrome installed on your Ubuntu system.

  3. Verify installation by checking chrome version

    google-chrome --version
    

    Note the version.

Step 2: Install chromedriver

  1. Move your ass to this url - https://chromedriver.chromium.org/downloads
  2. Open the link which has same version of of chrome version
  3. Now copy the link of chromedriver_linux64.zip from the page
  4. Download it:
    sudo wget https://chromedriver.storage.googleapis.com/104.0.5112.79/chromedriver_linux64.zip
    
  5. Unzip zip file (Install unzip if not installed already - sudo apt install unzip)
    sudo unzip chromedriver_linux64.zip
  6. Now execute below commands to configure ChromeDriver on your system.
    sudo mv chromedriver /opt/chromedriver 
    sudo chown root:root /opt/chromedriver 
    sudo chmod +x /opt/chromedriver

Step 3: Change the path of chromedriver in your script.

Change the executable_path value to /opt/chromedriver of your selenium driver object.

driver = Chrome(executable_path='/opt/chromedriver')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment