Last active
December 31, 2015 20:19
-
-
Save mitsuruog/8039638 to your computer and use it in GitHub Desktop.
soda sample code that selenium node driver.
This file contains 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
/** | |
* Module dependencies. | |
*/ | |
var soda = require('soda'), | |
assert = require('assert'); | |
var browser = soda.createClient({ | |
host: 'localhost', | |
port: 4444, | |
url: 'https://www.google.co.jp/', | |
browser: 'firefox' | |
}); | |
browser.on('command', function(cmd, args) { | |
console.log(' \x1b[33m%s\x1b[0m: %s', cmd, args.join(', ')); | |
}); | |
browser | |
.chain | |
.session() | |
.open('/') | |
.type('q', 'Hello World') | |
.click('btnK') | |
.waitForTextPresent('Hello World') | |
.getTitle(function(title) { | |
assert.ok(~title.indexOf('Hello World'), 'Title did not include the query: ' + title); | |
}) | |
.end(function(err) { | |
browser.testComplete(function() { | |
console.log('done'); | |
if (err) throw err; | |
}); | |
}); |
This file contains 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
mitsuruog:soda-sample mitsuruog$ node google.js | |
getNewBrowserSession: *firefox, https://www.google.co.jp/ | |
http.createClient is deprecated. Use `http.request` instead. | |
open: / | |
type: q, Hello World | |
click: btnK | |
waitForTextPresent: Hello World | |
getTitle: | |
testComplete: | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment