Protractor Test Cases Not Working in Internet Explorer 11

1.6k Views Asked by At

Protractor Test Cases Not Working in Internet Explorer 11 on Windows 10 Enterprise

Protractor.conf.js has below configuration.

seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumArgs: ['-Dwebdriver.ie.driver=node_modules/protractor/selenium/IEDriverServer.exe'],

multiCapabilities: [
  {
    browserName: 'internet explorer',
    'platform': 'ANY',
    'version': '11'
  }
]

When I try to run either ng e2e command to run the test cases, I get

Driver.version: unknown exception like below.

**Exception Trace:** 

[11:37:33] I/update - chromedriver: chromedriver_2.42.exe up to date
[11:37:33] I/launcher - Running 1 instances of WebDriver
[11:37:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[11:37:37] E/launcher - Unable to create session from {
  "desiredCapabilities": {
    "count": 1,
    "browserName": "internet explorer",
    "version": "11",
    "platform": "ANY"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "internet explorer"
      }
    ]
  }
}
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'DN13961', ip: '10.12.56.135', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
[11:37:37] E/launcher - SessionNotCreatedError: Unable to create session from {
  "desiredCapabilities": {
    "count": 1,
    "browserName": "internet explorer",
    "version": "11",
    "platform": "ANY"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "internet explorer"
      }
    ]
  }
}
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'DN13961', ip: '10.12.56.135', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at createDriver (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\index.js:635:14)
    at Hosted.getNewDriver (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
    at Runner.createBrowser (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\runner.js:195:43)
    at q.then.then (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\runner.js:339:29)
    at _fulfilled (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:796:13)
    at C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:556:49
    at runSingle (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:137:13)
    at flush (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
[11:37:37] E/launcher - Process exited with error code 199

Couple of trials I did as below.

  1. I have tried manually downloading the IEDriverServer.exe and started it manually before running ng e2e.
  2. Downloaded the IEDriverServer.exe and copied under selenium dir \node_modules\protractor\node_modules\webdriver-manager\selenium and then ran webdriver-manager update and webdriver-manager start and then ng e2e but I'm getting the same exception.
2

There are 2 best solutions below

0
On BEST ANSWER
  1. package.json will have script like below. (You have to add it under scripts tag).
    "webdriver-nodemodules-update-all-drivers": "cd .\node_modules\protractor\node_modules\webdriver-manager\bin & webdriver-manager update --standalone & webdriver-manager update --versions.gecko=v0.22.0 & webdriver-manager update --ie"
  2. Make sure protractor.conf.js has localSeleniumStandaloneOpts & multiCapabilities Code Image. Do like this. image code snipped (Unformatted) is below (Copy below code and format it in your ide- pls refer code image here and configure like that.) protractor.conf and format code.

    //directConnect: true, localSeleniumStandaloneOpts : { //jvmArgs : ["-Dwebdriver.ie.driver="] // e.g: "node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe" jvmArgs : ["-Dwebdriver.ie.driver=node_modules//protractor//node_modules//webdriver-manager//selenium//IEDriverServer3.14.0.exe"] // e.g: "node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe" }, 'autoStartStopServer': true, multiCapabilities:[ { 'browserName': 'chrome', chromeOptions: { // args: ['--headless', '--disable-gpu', '--window-size=1920,1080'] }, acceptInsecureCerts: true, shardTestFiles: true }, { 'browserName': 'firefox', 'marionette': true, firefoxOptions: { // args: ['--headless'] }, 'moz:firefoxOptions': { args: [ '--headless' ] }, directConnect: false, }, { 'browserName': 'internet explorer', 'platform': 'ANY', 'version': '11' } ],

  3. Then do run 3 commands - 'npm install', 'npm run webdriver-nodemodules-update-all-drivers' and then 'ng e2e' to run the test cases on (chrome/firefox/internet explorer) browsers. Note that webdriver-nodemodules-update-all-drivers command will only run if you have followed step 1.

1
On

Here is what solved my problem as per suggestion provided on the link. I have opened 'Registry Editor', did go to below path.

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\

And then created a new feature there by right clicking -> FEATURE_BECACHE -> then right click this feature and then create New->DWORD (32-Bit Value) and then rename the created DWORD as -> 'iexplore.exe'

Check the link below for the Registry Setting Being Made.

enter image description here