3

I am writing a script by using selenium. My problem is when the chrome has been automatically updated, my script is not working. So, my solution is learning the web chrome version (not driver) at the beginning and run the related chrome driver. So on my desktop I will keep all versions and run the correct one. But I could not find a solution to get the version of chrome. I will kindly appreciate the helps! Thanks in advance!

1 Answers1

8

Try this.

import subprocess
output = subprocess.check_output(
    r'wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value',
    shell=True
)
print(output.decode('utf-8').strip())

output

Version=79.0.3945.117
Satish
  • 1,976
  • 1
  • 15
  • 19