haim
haim

Reputation: 599

webdriver.io multiple threads in node server

I have an issue with webdirver.io if i send request to server to run webdriver.io, when there is already webdriver.io process running. the second request will stop the current webdriver.io running and will start new one. how can i keep both of them running.

i use NodeJS as server.

const webdriverio = require('webdriverio');
var phantomjs = require('phantomjs-prebuilt');

 let options = {
            logLevel: 'verbose',
            desiredCapabilities: {
                browserName: 'phantomjs'
            }
        };

Upvotes: 0

Views: 493

Answers (1)

You have to work with different profiles. When you didn´t choose unique profiles it will get bugged when you open it for the second time because it will try to use the current open profile. As example:

// setup browser
var options = {
   desiredCapabilities: {
   browserName: 'chrome',
   //javascriptEnabled: 'false'

   chromeOptions: {

     args: ['user-data-dir=C:/Users/Administrator/AppData/Local/Google/Chrome/User Data/instagram',
     windowSizeComplete,
     '--disable-popup-blocking',
    // '--no-sandbox',
     '--disable-flash-3d',
     '--disable-flash-stage3d',
     '--disable-java',
     '--disable-internal-flash',
     '--disable-cache',
     //'--disable-local-storage',
     '--disable-webgl', // webgl
     '--disable-3d-apis', // webgl
     //'--disable-extensions',
     '--disable-webgl-image-chromium',
     '--disable-reading-from-canvas',
     '--lang=en']
   } //  chromeOptions: {
 } // desiredCapabilities: {
} // options = {

Then call the webdriver.io with

const client = webdriverio.remote(options).init()

Upvotes: 1

Related Questions