Friday, May 26, 2017

Running chrome with extension while executing test cases using PROTRACTOR

Many of the guys have tried running Chrome browser with plugin or extension using protractor but couldn't do that. I did some researched and found solution for it. Google Chrome always run extension with uncompressed version which is present on Users\userName\AppData\Local\Google\Chrome\User Data\Default\Extensions The typical solutions we found on the internet to set arguments in Protractor.conf.js as below

The typical solutions we found on the internet to set args in Protractor.conf.js  as below


capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'args': ['--load-extension=' + '/Users/prashanthsams/Downloads/addon.crx']
    }



 }


but above solution will not work with the latest version of Chrome, here we need to use uncompressed version plugin. so how will do that?.


We need to set the path as below 

capabilities: {
    'browserName': 'chrome',
    'logName': 'Chrome',
    'count': 1,
    'chromeOptions': {
      'args': [ '--lang=en', '--window-size=1366,768','--load-extension=' + 'C:/Users/ahusain/AppData/Local/Google/Chrome/User Data/Default/Extensions/idgpnmonknjnojddfkpgkljpfnnfcklj/2.1.2_0' ]
    }
  }


Below is the snapshot running protractor test on Chrome with extension using above solution 



How you like this post. Please provide you input on this.This issue is very common during automation but hardly find this solution on the net as of now. If it's present there is couldn't find it.

Please leave your comment and let me know if any additional details required around it.



0 on: "Running chrome with extension while executing test cases using PROTRACTOR"