(Yum) 当远程安装 Google Chrome 时,你如何知道你有哪个版本(即你必须从命令行 运行 它)?

(Yum) How can you find out which version of Google Chrome you have when it is installed remotely (i.e. you have to run it from the command line)?

我想在 python 脚本中 运行 Selenium Webdriver,使用 Google Chrome。但是在 chromedriver 下载页面 (https://sites.google.com/a/chromium.org/chromedriver/downloads) 你必须知道你的 Google Chrome 版本。

我确实在我的 AWS 实例上安装了 Google Chrome,但是当我尝试远程 运行 它只是为了找出它是什么版本时,我遇到了分段错误:

来自我的 /usr/bin 文件夹:

[ec2-user@ip-xxx-xx-xx-xxx bin]$ ./google-chrome --version
Segmentation fault

你怎么能 运行 像这样从命令行远程安装它(当它被远程安装时),只是为了找出你有什么版本?

或者版本可能在其他地方指定,所以您不必从命令行运行它?

您可以尝试通过包管理器识别版本:

yum list installed|grep chrome

dpkg -l|grep chrome

取决于您的操作系统。

如果这不可能,请将其从二进制字符串中取出:

$ strings /opt/google/chrome/chrome | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,4}\.[0-9]{1,4}$'
7.9.317.33
127.0.0.1
79.0.3945.130
0.1.0.0
224.0.0.251
0.46.0.4
8.8.8.8
0.0.0.0
239.255.255.250
127.0.0.1
0.0.0.0

在我的例子中是版本 79.0.3945.130

问题是找到文件的二进制文件 - 在我的系统上它是符号链接到一个脚本。在脚本所在的同一文件夹中,二进制文件也有抵抗力。