如何使用 Selenium Server 2.20 获取执行服务器名称或地址 [英] How to get executing server name or address with Selenium Server 2.20

查看:20
本文介绍了如何使用 Selenium Server 2.20 获取执行服务器名称或地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Selenium Server 时,记录实际执行 selenium 脚本的机器的名称将非常有用.是否有可能获得该信息?

When working with Selenium Server, it would be very useful to log the name of the machine that actually does the execution of the selenium script. Is it possible to get that information?

我正在使用 C# 绑定,但用任何语言回答都可以.

I am working with C# bindings, but answer in any language would do fine.

推荐答案

我们应该知道 Selenium Server 在哪里运行.

We should know where the Selenium Server is running.

我们在 HttpCommandExecutor 类中有直接的方法,getAddressOfRemoteServer()

we have straight method for this in HttpCommandExecutor class, getAddressOfRemoteServer()

Firefox 代码:

code for Firefox :

RemoteWebDriver rcw = new RemoteWebDriver(new URL("http://serveraddress:portnumber/wd/hub"), DesiredCapabilities.firefox())

所以如果你有一个 RemoteWebDriver

IE 代码:

同上或本地

这篇关于如何使用 Selenium Server 2.20 获取执行服务器名称或地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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