Chrome extension appearing as Blocked when automation runs.

139 views
Skip to first unread message

Bhavesh Sharma

unread,
Jan 2, 2023, 7:01:40 AM1/2/23
to NightwatchJs
Hi All,

I have a very unique issue.

I have ModHeader extention installed in my chrome browser.  Vhrome is 108.X.X version.

When i access this extension like "chrome-extension://idgpnmonknjnojddfkpgkljpfnnfcklj/popup.html"  from chroe browser, it works fine.

Although i cannot find this extension location in my local computer. I tried looking at this location:
C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default\Extensions

That is the reason in my nightwatch.conf.js for chrome desired capabilities, i have not specified --load-extention option.

Now under my pages folder, i created a file by name "modheader.js" and added contents like this : 

module.exports = {
  elements: {
  },
  commands: [{
    setHeader() {
      const url = 'chrome-extension://idgpnmonknjnojddfkpgkljpfnnfcklj/popup.html'; // modHeader extension
      this.navigate(url).waitForElementPresent('body', 20000);
      // Uses Nightwatch Apis to add header information
      this.api.setValue('input[placeholder="Name"]', 'X-PF-Location');
      this.api.setValue('input[placeholder="Value"]', 'true');
    },
  }],
};


And in my test script i added test like this :

module.exports = {
    'Test1: Get URL and title': function (browser) {

     modHeaderPage = browser.page.modHeaderPage();
     modHeaderPage.setHeader();

     const mainnav = browser.page.mainNavigation();
     browser.windowMaximize();

     mainnav.navigate();

     mainnav.waitForInitialScreen();


     browser.end();
    }
};

When i run my test in chrome, i expect, it will enable the extension.  But when i run test, it access URL :
'chrome-extension://idgpnmonknjnojddfkpgkljpfnnfcklj/popup.html'

And then in UI i see error "'idgpnmonknjnojddfkpgkljpfnnfcklj is blocked'
and hence nothing goes ahead.

When i access this in chrome (without script), it works file and it shows me extension properly, but through automation script, it shows blocked.

In chrome, i allowed all cookies, no security setting, etc but still same issue.

Now, im not sure where it is having issues?  and what else i can do to get this working.
Until extension is not allowed,  my test will not work.

Any help is appreciated.
Let me know if any more info needed, i will add.

Bhavesh
Reply all
Reply to author
Forward
0 new messages