量角器测试用例在Internet Explorer 11中不起作用 [英] Protractor Test Cases Not Working in Internet Explorer 11

查看:85
本文介绍了量角器测试用例在Internet Explorer 11中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

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

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

我做了如下的试验.

  1. 我尝试手动下载IEDriverServer.exe并在运行ng e2e之前手动启动它.
  2. 下载IEDriverServer.exe并复制到硒dir \node_modules\protractor\node_modules\webdriver-manager\selenium下,然后依次运行webdriver-manager updatewebdriver-manager start然后ng e2e,但是我遇到了相同的异常.
  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.

推荐答案

  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 代码图像.这样做吧.下面是(未格式化的)被剪切的图像代码(在下面复制代码并在其内部格式化,请在此处引用代码图像并进行类似的配置.)protractor.conf并设置代码格式.

  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:是的, 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:{ //args:['-headless'] }, 'moz:firefoxOptions':{ args:['--headless'] }, directConnect:false, }, { 'browserName':'互联网浏览器', 'platform':'ANY', '版本':'11' } ]

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

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.

这篇关于量角器测试用例在Internet Explorer 11中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆