vendredi 28 août 2015

How run two Chrome driver for one profile with Selenium Webdriver Nodejs?

I write tests, and for the speed, i want, that user has already been authenticated (+ loaded data in local store).

import * as webdriver from 'selenium-webdriver';
import * as Chrome from 'selenium-webdriver/chrome';
var options = new Chrome.Options();

options.addArguments('--user-data-dir=C:\\profilepath');

var driver = new webdriver.Builder().withCapabilities(options.toCapabilities()).build();

driver.get("http://site.ru/").then(() => {
    console.log('Opened');
}, (err) => {
    console.log('Err', err);
});
var driver2 = new webdriver.Builder().withCapabilities(options.toCapabilities()).build();
driver2.get("http://site.ru/").then(() => {
    console.log('Opened');
}, (err) => {
    console.log('Error', err);
});

The first driver works good, opens the page, the second just hanging initial screen without any errors. Same for starts them in different processes ...

Aucun commentaire:

Enregistrer un commentaire