Monday, November 21, 2016

Selenium-Chrome Matchmaking: Syncing ChromeDriver and Selenium Server Versions

If you use Selenium Server in your browser automation tasks (either as a standalone JAR executable or via a manager like webdriver-manager for Protractor or NightWatch), you may already come across the error <browser> version must be (>|<)= x.xx. While upgrading/downgrading the installed browser may appear to be a straightforward solution, you can simply upgrade/downgrade the Selenium driver for the respective browser at a fraction of the overhead.

For example, for a Google Chrome 48.0.2564.79 installation against Protractor 4.0.10 (which installs ChromeDriver 2.25 by default, subsequently leading to the error Chrome version must be >= 53.0.2785.0):

  1. Find the version of the Selenium driver compatible with the installed Chrome version. You can find the compatible Chrome versions for different ChromeDriver releases at https://chromedriver.storage.googleapis.com/2.25/notes.txt (change "2.25" to a newer version if your Chrome version is newer than what is listed there).

    The installed driver version would be displayed along with the error message you encountered, so it would be easy to determine whether you need to go up or down in the driver version hierarchy. However, newer release notes usually include compatibility details of all previous versions as well, so checking the latest version changelog would almost always be sufficient.

  2. ChromeDriver 2.20 seems compatible, so let's install it:

    webdriver-manager update --chrome --versions.chrome=2.20
  3. Now, specify the appropriate ChromeDriver version when starting Selenium via webdriver-manager:

    webdriver-manager start --versions.chrome=2.20

    If webdriver-manager is unavailable, you can simply download the required ChromeDriver version and use some technique to pass the following parameter to the Selenium server startup command:

    -Dwebdriver.chrome.driver=/path/to/the/desired/chromedriver_version

No comments:

Post a Comment

Thanks for commenting! But if you sound spammy, I will hunt you down, kill you, and dance on your grave!