Last active
January 2, 2016 01:59
-
-
Save alfonsodev/8233972 to your computer and use it in GitHub Desktop.
example of chrome-driver web fixed
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
var webdriver = require('selenium-webdriver'); | |
var flow = webdriver.promise.controlFlow(); | |
var driver = new webdriver.Builder(). | |
withCapabilities(webdriver.Capabilities.chrome()). | |
build(); | |
driver.get('http://www.google.com'); | |
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver'); | |
driver.findElement(webdriver.By.name('btnG')).click(); | |
driver.wait(function() { | |
return driver.getTitle().then(function(title) { | |
return title === 'webdriver - Buscar con Google'; | |
}); | |
}, 4000); | |
flow.on('uncaughtException', function(err) { | |
console.log('There was an uncaught exception: ' + err); | |
}); | |
driver.quit(); |
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
var assert = require('assert'), | |
test = require('selenium-webdriver/testing'), | |
webdriver = require('selenium-webdriver'), | |
flow = webdriver.promise.controlFlow(); | |
test.describe('Google Search', function() { | |
var driver = new webdriver.Builder(). | |
withCapabilities(webdriver.Capabilities.chrome()). | |
build(); | |
test.it('should work', function(done) { | |
driver.get('http://www.google.com'); | |
var searchBox = driver.findElement(webdriver.By.name('q')); | |
searchBox.sendKeys('webdriver'); | |
searchBox.getAttribute('value').then(function(value) { | |
assert.equal(value, 'webdriver'); | |
}); | |
}); | |
test.after(function(){ | |
driver.quit(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment