Created
June 29, 2015 16:05
-
-
Save sebv/1c638fad003e58a66f72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('colors'); | |
var wd; | |
try { | |
wd = require('wd'); | |
} catch( err ) { | |
wd = require('../../lib/main'); | |
} | |
var browser = wd.promiseChainRemote(); | |
// optional extra logging | |
browser.on('status', function(info) { | |
console.log(info.cyan); | |
}); | |
browser.on('command', function(eventType, command, response) { | |
console.log(' > ' + eventType.cyan, command, (response || '').grey); | |
}); | |
browser.on('http', function(meth, path, data) { | |
console.log(' > ' + meth.magenta, path, (data || '').grey); | |
}); | |
/* jshint evil: true */ | |
browser | |
.init({browserName:'firefox'}) | |
.get("http://admc.io/wd/test-pages/guinea-pig.html") | |
.elementById('i_am_a_textbox').type('Something Cool') | |
.sleep(1000) | |
.elementById('i_am_a_textbox').keys([wd.SPECIAL_KEYS.Meta, 'a']) | |
.sleep(1000) | |
.elementById('i_am_a_textbox').keys(['x', wd.SPECIAL_KEYS.NULL]) | |
.sleep(1000) | |
.elementById('comments').click() | |
.keys([wd.SPECIAL_KEYS.Meta, 'v', wd.SPECIAL_KEYS.NULL]) | |
.sleep(5000) | |
.fin(function() { return browser.quit(); }) | |
.done(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment