Selenium – This version of ChromeDriver only supports Chrome version 85 error on Ubuntu

I use Selenium web driver to scrap some website data that I need for my property analysis. In this case I use chromedriver.

When I want to run it after I upgraded my Chrome browser on Ubuntu I found this error.

This version of ChromeDriver only supports Chrome version 85 

My steps to resolve this

1) Check my Chrome browser version and found it is 87.

google browser version
google browser version

2) Check my chromedriver version by typing

chromedriver --v
ubuntu check chromedriver version
ubuntu check chromedriver version

I found my version is 85 not same as my browser.

3) Check the location of the chrome driver by typing

echo $PATH

In my case I found my chrome driver at /usr/local/sbin

chrome driver location on ubuntu
chrome driver location on ubuntu

4) Download the latest chromedriver at Google ChromeDriver Website

5) After extracting the latest chromedriver, replace the old one.

mv [latest chromedriver file] [location of current chromedriver]
ubuntu replace old chromedriver
ubuntu replace old chromedriver

Then when I run back my program, it works!

Selenium Webdriver How To Increase Time Out for Page Load, Script Load or Element Locator

I couldn’t find at Stackoverflow on how to increase the timeout and the Selenium API not that easy to find on how to use it.

For Selenium WebDriver using NodeJS below is how to increase its time outs. The number is in milliseconds.

 let driver = await new Builder().forBrowser('chrome')
                .setChromeOptions(new chrome.Options().headless())
                .setFirefoxOptions(new firefox.Options().headless())
                .build();

 driver.manage().setTimeouts({implicit: 120000, script: 120000, pageLoad:120000});

From Selenium Documentation

The following timeouts are supported (all timeouts are specified in milliseconds):

  • implicit specifies the maximum amount of time to wait for an element locator to succeed when locating elements on the page. Defaults to 0 milliseconds.
  • pageLoad specifies the maximum amount of time to wait for a page to finishing loading. Defaults to 300000 milliseconds.
  • script specifies the maximum amount of time to wait for an evaluated script to run. If set to null, the script timeout will be indefinite. Defaults to 30000 milliseconds.

Reference:
https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_Options.html