3

When running tests against IE in browserstack it seems that IE is coming up with a security exception message:

enter image description here

This is coming up because the backend api that is being called is using a self signed cert which is untrusted (it needs to be like this for CI as the api has a different url each time CI creates the backend)

What needs to happen for this automated test to run is that the dialog needs to be accepted (or not come up at all) - but I dont see any way of doing this through the nightwatch framework.

I have tried things like, clicking the left arrow using browser.setValue('button', [browser.Keys.LEFT_ARROW]); and also tried clicking the button with the 'Yes' value but nothing seems to work.

I have also set acceptSslCerts in my ie profile setup:

    "ci_ie": {
      "launch_url" : "http://hub.browserstack.com",
      "selenium_port"  : 80,
      "selenium_host"  : "hub.browserstack.com",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "ie",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
        "ignoreProtectedModeSettings": true,
        "browser_version": "10",
        "os_version": "7",
        "os": "windows"
      }
    }

Any ideas on how to resolve this would be greatly appreciated.

Marty
  • 2,965
  • 4
  • 30
  • 45

2 Answers2

2

Correct, you cannot control this popup via selenium webdriver, it is out of the scope/reach of it.

Instead, you need to prevent it from being shown in the first place:

In case of IE, you should set the acceptSslCerts desired capability to "true":

"desiredCapabilities" : {
  "browserName" : "internet explorer",
  "javascriptEnabled" : true,
  "acceptSslCerts" : true,
}

You might also need to set the ignoreProtectedModeSettings to "true":

"desiredCapabilities" : {
  "browserName" : "internet explorer",
  "javascriptEnabled" : true,
  "acceptSslCerts" : true,
  "ignoreProtectedModeSettings": true
}

There is also this workaround (you might need to set acceptSslCerts to "false" for that to work).

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • I have updated my question, I have already set acceptSslCerts to true. Without this it doesnt even get past the first page. Its as if this setting doesnt account for XHR requests on a different domain ? – Marty Dec 14 '15 at 02:06
  • @Marty okay, I suspected that it won't be that easy. Updated, please try with "ignoreProtectedModeSettings". – alecxe Dec 14 '15 at 02:11
  • I have tried with all of these: `"trustAllSSLCertificates": true, "acceptSslCerts": true, "ignoreProtectedModeSettings": true,` and still no go :( – Marty Dec 14 '15 at 02:13
  • @Marty okay, thanks. What if you would try the workaround from the linked answer? (it is in java though and needs to be translated to javascript/nightwatchjs) – alecxe Dec 14 '15 at 02:15
  • I have tried to do something like: `browser.url('javascript:document.getElementById(\'overridelink\').click()');` which is in nightwatch format, doesnt seem to do anything – Marty Dec 14 '15 at 03:24
2

I fixed this by adding:

"unexpectedAlertBehaviour": "accept"

to the desiredCapabilities section in my nightwatch config.

I think it maybe due to acceptSslCerts getting ignored for XHR requests.

Marty
  • 2,965
  • 4
  • 30
  • 45