javascript webdriverjs 和 webdriverio 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27174083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between webdriverjs and webdriverio
提问by dadi zreik
I am trying to choose a tool for Javascript automation tests.
我正在尝试为 Javascript 自动化测试选择一个工具。
Until now I used Selenium WebDriver in Java with TestNG to build my tests, but I have been asked to search for JavaScript solution to write tests.
到目前为止,我在 Java 中使用 Selenium WebDriver 和 TestNG 来构建我的测试,但我被要求搜索 JavaScript 解决方案来编写测试。
Of course the first thing on my mind was to move to WebDriverJs- it should be similar to my Java tests.
当然,我想到的第一件事是转向WebDriverJs- 它应该类似于我的 Java 测试。
But, I also found another framework: WebdriverIO. I could not find anything that could be done with WebdriverIO that is not possible with WebDriverJs.
但是,我还发现了另一个框架:WebdriverIO。我找不到 WebdriverIO 可以完成的任何事情,而 WebDriverJs 则无法做到。
Please help me to understand the difference so I can choose the right framework for me.
请帮助我了解差异,以便我可以为我选择正确的框架。
回答by Dan Dascalescu
"WebdriverJS" is another name for selenium-webdriver, the official Node.JS implementation of the JSONWire (WebDriver Wire) Protocolby the Selenium team.
“WebdriverJS”是selenium-webdriver 的另一个名称,它是 Selenium 团队对JSONWire(WebDriver Wire)协议的官方 Node.JS 实现。
"WebdriverIO"is an independent implementation of the JSON Wire Protocol by Christian Bromann(SO profile), who works at Sauce Labs, a provider of cloud-base cross-browser testing. WebdriverIO wraps its lower level requests into useful commands, with a concise syntax:
“WebdriverIO”是由Christian Bromann( SO profile)对JSON Wire Protocol 的独立实现,他在基于云的跨浏览器测试提供商Sauce Labs 工作。WebdriverIO 使用简洁的语法将其较低级别的请求包装成有用的命令:
client
.url('http://google.com')
.setValue('#q','webdriver')
.click('#btnG')
The same test with selenium-webdriver is more complicated:
用 selenium-webdriver 做同样的测试更复杂:
driver.get('http://www.google.com');
driver.findElement(webdriver.By.id('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.id('btnG')).click();
There are at least seven Webdriver clients written in Node.JS.
回答by Prashant Sinha
WebdriverJSis actually what WebdriverIOpacks along with a test runner in a node package format.
There isn't really anything that can't be done with WebdriverJS that WebdriverIO will do.
You can use WebdriverJS along with Jasmine or Mocha as well.
WebdriverJS实际上是WebdriverIO与节点包格式的测试运行程序一起打包的内容。没有什么是 WebdriverJS 无法完成的,而 WebdriverIO 可以做到。您也可以将 WebdriverJS 与 Jasmine 或 Mocha 一起使用。
Of course, the wrappers in WebdriverJS and WebdriverIO are differently labelled but that does not change the way they implement Webdriver WIRE protocol.
当然,WebdriverJS 和 WebdriverIO 中的包装器的标签不同,但这不会改变它们实现 Webdriver WIRE 协议的方式。
If you are into testing AngularJS based apps, there's a even more streamlined implementation of WebDriver WIRE protocol in Protractor (which is again distributed as a node package).
如果您正在测试基于 AngularJS 的应用程序,那么 Protractor 中有一个更加简化的 WebDriver WIRE 协议实现(它再次作为节点包分发)。

