量角器测试用例在Internet Explorer 11中不起作用

时间:2018-10-02 15:57:39

标签: selenium-webdriver protractor internet-explorer-11 selenium-iedriver

量角器测试用例在Windows 10企业版的Internet Explorer 11中不起作用

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'
  }
]

当我尝试运行任何ng e2e命令来运行测试用例时,都会得到

  

Driver.version:未知异常,如下所示。

**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

我做了如下的试验。

  1. 我尝试手动下载IEDriverServer.exe并在运行ng e2e之前手动启动它。
  2. 下载IEDriverServer.exe并复制到硒目录\node_modules\protractor\node_modules\webdriver-manager\selenium下,然后依次运行webdriver-manager updatewebdriver-manager start然后运行ng e2e,但是我遇到了同样的异常。
  3. li>

2 个答案:

答案 0 :(得分:0)

根据链接上的建议,这是解决我的问题的方法。我已经打开了“注册表编辑器”,确实转到了下面的路径。

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

然后右键单击-> FEATURE_BECACHE->在此处创建新功能,然后右键单击此功能,然后创建New-> DWORD (32-Bit Value),然后将创建的DWORD重命名为- > 'iexplore.exe'

在下面的链接中查看正在进行的注册表设置。

enter image description here

答案 1 :(得分:0)

  1. package.json将具有如下脚本。 (您必须在scripts标签下添加它。)
    “ webdriver-nodemodules-更新所有驱动程序”:“ cd。\ node_modules \ protractor \ node_modules \ webdriver-manager \ bin&webdriver-manager update --standalone和webdriver-manager update --versions.gecko = v0.22.0& webdriver-manager更新--ie“
  2. 确保protractor.conf.js具有localSeleniumStandaloneOpts和multiCapabilities Code Image. Do like this.图像代码片段(未格式化)在下面(复制下面的代码并将其格式化为您的想法,请在此处引用代码图像并进行类似配置。)protractor.conf和格式代码。

    // directConnect:是的,     localSeleniumStandaloneOpts:{         //jvmArgs:["-Dwebdriver.ie.driver="]//例如:“ node_modules /量角器/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe”         jvmArgs:[“-Dwebdriver.ie.driver = node_modules //量角器//node_modules//webdriver-manager//selenium//IEDriverServer3.14.0.exe”] //例如:“ node_modules / protractor / node_modules / webdriver-manager / selenium / IEDriverServer_x64_X.XX.X.exe“         },       'autoStartStopServer':是的,       multiCapabilities:[         {          'browserName':'chrome',          chromeOptions:{ //参数:['-headless','-disable-gpu','-window-size = 1920,1080']          },          acceptInsecureCerts:是的,          shardTestFiles:是        },        {         'browserName':'firefox',         '木偶':是的,         firefoxOptions:{   //参数:['-headless']         },         'moz:firefoxOptions':{           args:['--headless']         },         directConnect:false,         },         {           'browserName':'互联网浏览器',           'platform':'ANY',           '版本':'11'         }      ]

  3. 然后运行3个命令-'npm install','npm run webdriver-nodemodules-update-all-drivers',然后再执行'ng e2e'来运行测试用例(chrome / firefox / internet Explorer)浏览器。请注意,只有在遵循步骤1的情况下,webdriver-nodemodules-update-all-drivers命令才会运行。