[英]How do you use RemoteWebDriver in the javascript language bindings? (Running on Node.js)
I am trying to use the javascript language bindings to connect to a RemoteWebDriver, but I am having difficulty getting it to work, and the API documentation does not have any examples for RemoteWebDriver. 我正在尝试使用javascript语言绑定来连接到RemoteWebDriver,但是我很难使其正常工作,而且API文档中没有RemoteWebDriver的任何示例。 I've seen a few examples around of something like this supposedly working:
我已经看到了一些类似的示例,这些示例据说可以正常工作:
//Javascript example - not working
const webDriver = new Builder()
.usingServer(url)
.withCapabilities(/*don't know what to put here /*)
.build();
I cannot figure which capabilities are needed. 我无法确定需要哪些功能。 A further complication is the remote webdriver I'm connecting to is a home rolled implementation of the protocol.
进一步的麻烦是,我连接的远程Webdriver是协议的本地实现。 As a test, I got the java version of RemoteWebDriver to work:
作为测试,我让RemoteWebDriver的Java版本可以工作:
//Java example - working
Capabilities capabilities = new DesiredCapabilities();
RemoteWebDriver driver;
driver = new RemoteWebDriver (url, capabilities);
I have a strong suspicion that the capabilities I am using in the javascript example are not sufficient, but I cannot figure out what the builder interface is expecting. 我非常怀疑我在javascript示例中使用的功能还不够,但是我无法弄清楚生成器界面的期望。 The default capabilities seem to work in the java version, but what are those?
默认功能似乎可以在Java版本中使用,但是这些功能是什么?
Any help will be greatly appreciated. 任何帮助将不胜感激。
If you are using JS bindings, set the below environment variables as mentioned here 如果您使用的是JS绑定,请按照此处所述设置以下环境变量
SELENIUM_BROWSER=chrome:36:LINUX \
SELENIUM_REMOTE_URL=http://www.example.com:4444/wd/hub \
then you can just do 那你就可以做
var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.