Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
Created June 29, 2016 16:48
Show Gist options
  • Select an option

  • Save remarkablemark/ff9537b605868208ee2830e701ea48df to your computer and use it in GitHub Desktop.

Select an option

Save remarkablemark/ff9537b605868208ee2830e701ea48df to your computer and use it in GitHub Desktop.
Run multiple browsers in parallel using WebDriverJS flow.
'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();
});
@Rup1
Copy link
Copy Markdown

Rup1 commented Sep 30, 2019

They deprecated the whole createflow functionality :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment