Created
January 10, 2018 08:22
-
-
Save mjul/49d7d2a50105baaf69c268dd51bb062b to your computer and use it in GitHub Desktop.
Selenium Javascript web-driver API with promises
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'), | |
By = webdriver.By, | |
until = webdriver.until, | |
logging = webdriver.logging; | |
// Selenium's promise module provides logging to report every instance of unsynchronized code running through the promise manager | |
logging.installConsoleHandler(); | |
logging.getLogger('promise.ControlFlow').setLevel(logging.Level.ALL); | |
new webdriver.Builder() | |
.forBrowser('chrome') | |
.build() | |
.then(driver => createInitialState(config, driver)) | |
.then(state => state.transitions.openStartPage()) | |
.then(state => maximizeWindow(state)) | |
.then(state => takeScreenshot(state)) | |
.then(state => state.transitions.login()) | |
.then(state => takeScreenshot(state)) | |
.then(state => state.driver.quit()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment