通过python学习chrome浏览器版本

Ogu*_*dag 3 python selenium google-chrome selenium-chromedriver

我正在使用硒编写脚本。我的问题是当 chrome 自动更新时,我的脚本无法工作。所以,我的解决方案是一开始就学习web chrome版本(不是驱动程序)并运行相关的chrome驱动程序。因此,在我的桌面上,我将保留所有版本并运行正确的版本。但我找不到获取 chrome 版本的解决方案。我将不胜感激的帮助!提前致谢!

Sat*_*ish 8

尝试这个。

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())
Run Code Online (Sandbox Code Playgroud)

输出

Version=79.0.3945.117
Run Code Online (Sandbox Code Playgroud)