0

I wanted to install chromedriver that supports the current local chrome browser version in runtime.

Code should work like this:

1. First checks version of chrome browser.
2. Install the chromedriver corresponds to that chrome browser version.

I have tried: pip install chromedriver-py

but it installs latest version of chromedriver, but I want the version that suppports local chrome browser.

please help me if anyone finds a solution.

Rohan Sharma
  • 25
  • 1
  • 6

1 Answers1

0

You basically want us to write the whole code.. Anyhow, here is just a vague idea which you can implement with a bit of research:


Regarding your first step:
  1. First checks version of chrome browser.

According to the Google ChromeDriver requirements the download path of Chrome can be expected in a certain download path, depending on your system. You either could check (like another user has done it: https://sqa.stackexchange.com/questions/41354/programmatically-determine-chrome-browser-version-regardless-of-os) the chrome version via chrome.exe --version or read the file names of the directory chrome.exe is installed:

enter image description here

The first file (maybe verify via regex) is my chrome version, 87.0.4280.88. I'd suggest taking a look at How do I list all files of a directory?.

  1. Install the chromedriver corresponds to that chrome browser version.

That's also doable with a little bit of research. You got all the download links on https://chromedriver.chromium.org/downloads. Just check for matching version and grab the respective link. If that doesn't suit your needs, maybe consider pre-installing the versions and implementing the proper one (depending on the version of the chrome browser).

J. M. Arnold
  • 6,261
  • 3
  • 20
  • 38