Skip to content

Instantly share code, notes, and snippets.

@kidig kidig/nodejs-wd-sample.js

Last active Dec 19, 2015
What would you like to do?
This is a sample of using node.js, selenium wd for testing search at
var wd = require('wd'),
assert = require('assert'),
colors = require('colors'),
browser = wd.promiseRemote();
browser.on('status', function(info) {
browser.on('command', function(meth, path, data) {
console.log(' > ' + meth.yellow, path.grey, data || '');
browserName: 'chrome',
tags: ["examples", "yandex"],
name: "This is a test for yandex search"
}).then(function() {
return browser.get('');
}).then(function() {
return browser.title();
}).then(function(title) {
assert.ok(~title.indexOf("Yandex"), 'Wrong title!');
return browser.elementById('searchInput');
}).then(function(el) {
el.type("moscow city");
return browser.elementByCssSelector('form .b-search__table .b-search__button');
}).then(function(el) {
return browser.clickElement(el);
}).then(function(err) {
browser.title(function(err, title) {
}).fin(function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.