Created
June 29, 2016 16:48
-
-
Save remarkablemark/ff9537b605868208ee2830e701ea48df to your computer and use it in GitHub Desktop.
Run multiple browsers in parallel using WebDriverJS flow.
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
| 'use strict'; | |
| /** | |
| * Module dependencies. | |
| */ | |
| const webdriver = require('selenium-webdriver'); | |
| /** | |
| * Open each driver in parallel. | |
| * | |
| * https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/example/parallel_flows.js | |
| */ | |
| ['chrome', 'firefox', 'safari'].forEach((browserName, index) => { | |
| const flow = new webdriver.promise.ControlFlow(); | |
| flow.on('uncaughtException', (error) => { | |
| console.error(index, 'uncaughtException in flow', error); | |
| }); | |
| const builder = new webdriver.Builder(); | |
| builder.forBrowser(browserName); | |
| // magic happens here... | |
| builder.setControlFlow(flow); | |
| const driver = builder.build(); | |
| // position and resize window so it's easy to see them running together | |
| driver.manage().window().setSize(600, 400); | |
| driver.manage().window().setPosition(300 * index, 400 * index); | |
| driver.sleep(5000); | |
| driver.quit(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
They deprecated the whole createflow functionality :(