如何通过硒服务器独立命令行指定Chrome二进制位置? [英] How to specify the Chrome binary location via the selenium server standalone command line?

查看:100
本文介绍了如何通过硒服务器独立命令行指定Chrome二进制位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是不存储在我的Windows 7计算机的默认位置的Google Chrome的便携版本。我没有管理员权限在默认位置安装Chrome。

I am using a portable version of Google Chrome that is not stored at the default location of my Windows 7 machine. I don't have admin rights to install Chrome at the default location.

运行 java -jar selenium-server-standalone-2.52.0。 jar -help 并不暗示将路径设置为 chrome二进制不是Chrome驱动程序)的可能性。

Running java -jar selenium-server-standalone-2.52.0.jar -help does not hint any possibility of setting the path to the chrome binary (not the chrome driver).

Chrome驱动程序功能表示可以设置二进制,但我不知道如何通过命令行执行。

The chrome driver capabilities indicate that it's possible to set the binary but I'm not sure how to do it via the command line.

推荐答案

您可以在ChromeOptions中为Chrome二进制文件指定一个非标准位置。

You can specify a non-standard location for the chrome binary in ChromeOptions.

ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome/binary");

请参阅ChromeOptions文档:
https://sites.google.com /a/chromium.org/chromedriver/capabilities#TOC-Using-a-Chrome-executable-in-a-non-standard-location

See the ChromeOptions documentation at: https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-Using-a-Chrome-executable-in-a-non-standard-location

这篇关于如何通过硒服务器独立命令行指定Chrome二进制位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆