简体   繁体   English

以编程方式在远程计算机上启动Selenium Hub

[英]Start a selenium hub on a remote machine programmatically

How can we start a selenium grid hub on a remote machine programmatically? 我们如何以编程方式在远程计算机上启动硒网格中心?

As of now, i know the following ways of doing it but i have some questions on those. 截至目前,我知道以下操作方式,但对此有一些疑问。

Approach 1: Execute a batch file on remote machine with required command (java -jar selenium-server-standalone-2.14.0.jar -role hub) to start the hub. 方法1:使用必需的命令(java -jar selenium-server-standalone-2.14.0.jar -role hub)在远程计算机上执行批处理文件以启动hub。 (using PSExec to execute command on remote machine) (使用PSExec在远程计算机上执行命令)

No questions and issues with above approach. 以上方法没有问题。 But looking for an API way of doing this . 但是正在寻找一种实现此目的的API方法

Approach 2: This approach (I didn't try this way since these are JAVA APIs and i have very little knowledge in JAVA). 方法2: 这种方法(我没有尝试过这种方法,因为它们是JAVA API,而且我对JAVA的了解很少。)

Q1: Can we use the above approach to start the hub on a remote machine? 问题1:我们可以使用上述方法在远程计算机上启动集线器吗?

Q2: Does selenium server jar file is required in this approach? Q2:这种方法是否需要硒服务器jar文件?

Can we use these APIs in our program (some how making a POST or GET http request with required configuration in JSON ) to configure Hub on a remote machine and start it? 我们是否可以在程序中使用这些 API(以某种方式在JSON中进行具有所需配置的POST或GET http请求),以在远程计算机上配置Hub并启动它? (I know console way of using these APIs with selenium server jar file) (我知道将这些API与Selenium服务器jar文件一起使用的控制台方式)

The only way to start selenium grid is by running command on remote machine using the below command 启动硒网格的唯一方法是使用以下命令在远程计算机上运行命令

java -jar Selenium-server.jar -role hub java -jar Selenium-server.jar-角色中心

you can make a batch file for this command to ease of use specifiy the name of jar file with your file 您可以为此命令制作一个批处理文件,以便于使用时指定jar文件的名称

试试这个RemoteWebDriver rWD =新的RemoteWebDriver(新的URL(“ http://” + {{Hub_Name}} +“:4444 / wd / hub”),desiredCapabilities);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM