A Pen by Nathan Bingham on CodePen.
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
// Example of nesting wd.js callbacks | |
browser.get("http://admc.io/wd/test-pages/guinea-pig.html", function() { | |
browser.title(function(err, title) { | |
assert.ok(~title.indexOf('I am a page title - Sauce Labs'), 'Wrong title!'); | |
browser.elementById('i am a link', function(err, el) { | |
browser.clickElement(el, function() { | |
browser.eval("window.location.href", function(err, href) { | |
assert.ok(~href.indexOf('guinea-pig2')); | |
browser.quit(); | |
}); |
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
// Anatomy of a brewie test | |
// The test below will check whether the form on the bottom of modern.IE's homepage | |
// triggers a test when the URL www.microsoft.com is entered and the 'Scan' button | |
// is clicked. | |
// Import chai.js's should module | |
var should = require('chai').should(); | |
// Tests follow mocha's BDD-style syntax |
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
var should = require('chai').should(), | |
config = require('config'), | |
http = require('http'); | |
module.exports = function(){ | |
var pageUrl = "http://www.cnn.com/testing"; | |
console.log('loaded?'); |
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
Should we do ... | |
it("should do", function(done){ | |
return class.hasTitle(browser, "home", done); | |
}); | |
-- or -- | |
it("should do", function(done){ |
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
Uncaught Error: Error response status: 13. | |
at webdriver._newError (/usr/local/lib/node_modules/brewie/node_modules/wd/lib/webdriver.js:74:13) | |
at webdriver._callbackWithDataBase (/usr/local/lib/node_modules/brewie/node_modules/wd/lib/webdriver.js:150:25) | |
at Request.webdriver._jsonWireCall [as _callback] (/usr/local/lib/node_modules/brewie/node_modules/wd/lib/webdriver.js:345:5) | |
at Request.init.self.callback (/usr/local/lib/node_modules/brewie/node_modules/wd/node_modules/request/index.js:148:22) | |
at Request.EventEmitter.emit (events.js:99:17) | |
at Request.onResponse (/usr/local/lib/node_modules/brewie/node_modules/wd/node_modules/request/index.js:876:14) | |
at Request.EventEmitter.emit (events.js:126:20) | |
at IncomingMessage.Request.onResponse.buffer (/usr/local/lib/node_modules/brewie/node_modules/wd/node_modules/request/index.js:827:12) | |
at IncomingMessage.EventEmitter.emit (events.js:126:20) |
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
browser | |
.get(pageUrl) | |
.then(function(){ | |
return browser.elementById("url"); | |
}) | |
.then(function(scaninput){ | |
return browser.type(scaninput,'microsoft'); | |
}) | |
.then(function(){ | |
return browser.elementById("check_site"); |
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
module ConfigManager { | |
export class Browser {} | |
export class Config { | |
name:String; | |
} |
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
// Sniffing for IE | |
var isIE = navigator.userAgent.match( /MSIE\s(\d)/ ); | |
if ( isIE && parseInt( isIE[ 1 ], 10 ) >= 9 ) { | |
executeAwesome(); | |
} else { | |
alert( "This feature is not supported!" ); | |
} |
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
# Install tidy | |
brew install tidy | |
# Export the Word doc as HTML | |
# Create a config file named tidy-config.txt like below | |
# Find more at http://tidy.sourceforge.net/ | |
tidy -config tidy-config.txt -o cleaned.html -i dirty.htm |