4 ms·
I'm curious why they didn't build on the "wd" implementation of the WebDriver protocol for Node.js: https://github.com/admc/wd https://github.com/admc/wd Perso
by tlrobinson 13y ago
I'm curious why they didn't build on the "wd" implementation of the WebDriver protocol for Node.js: https://github.com/admc/wd https://github.com/admc/wd
Personally I like just using "wd" along with a promise helper library or two.
Here's an example using q-proxy (https://npmjs.org/package/q-proxy https://npmjs.org/package/q-proxy) and q-step (https://npmjs.org/package/q-step https://npmjs.org/package/q-step). The result is a pretty nice syntax (admittedly nicer in CoffeeScript than JavaScript) and a lot more flexibility to do other logic:
browser = QProxy(wd.promiseRemote("localhost", 4444))
QStep(
-> browser.init(browserName: "firefox")
-> browser.get("https://www.facebook.com/")
-> browser.elementById("email").type(credentials.email)
-> browser.elementById("pass").type(credentials.password)
-> browser.elementById("u_0_b").click()
)
Or wd's own built-in promise chaining is pretty similar to Nightwatch.js as well:
browser
.init({browserName:'chrome'})
.get("http://admc.io/wd/test-pages/guinea-pig.html")
.title()
.should.become('WD Tests')
.elementById('i am a link')
.click()
.eval("window.location.href")
.should.eventually.include('guinea-pig2')
.back()
.elementByCss('#comments').type('Bonjour!')
.getValue().should.become('Bonjour!')
.fin(function() { return browser.quit(); })
.done();