量角器错误-失败:WebDriverError

时间:2019-08-13 05:40:17

标签: protractor

当我使用量角器运行规格登录应用程序时,总是收到错误消息“ WebDriverError”,日志中没有更多详细信息

message="Failed: WebDriverError"
at stack (c:\Users\01.ISSA\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2338:17)
at buildExpectationResult (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2308:14)
at Spec.expectationResultFactory (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:858:18)
at Spec.addExpectationResult (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:487:34)
at Env.fail (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1286:25)
at Function.next.fail (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:4272:19)
at c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasminewd2\index.js:64:48
at ControlFlow.emit (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\selenium-webdriver\lib\events.js:62:21)
at ControlFlow.shutdown_ (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\selenium-webdriver\lib\promise.js:2674:10)
at shutdownTask_.MicroTask (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\selenium-webdriver\lib\promise.js:2599:53)]]

调试代码,找到导致错误的代码行:

var url = browser.params.login.Url;
browser.get(url);

Conf.js:

var path = require('path');
var jasmineReporters = require('jasmine-reporters');
exports.config = {
    directConnect: true,

capabilities: {
   'browserName': 'firefox'
   },

 // Framework to use. Jasmine is recommended.
framework: 'jasmine2',

allScriptsTimeout: 100000,

suites: {
         mytest: ['./cognitivePO/LoginPage.js','./cognitivePO  /deleteOpportunity.js'],
  },

 plugins: [{
        package: 'jasmine2-protractor-utils',
        disableHTMLReport: false,
        disableScreenshot: true,
        screenshotPath:'./reports/screenshots',
        screenshotOnExpectFailure:true,
        screenshotOnSpecFailure:false,
        clearFoldersBeforeTest: true,
        htmlReportDir: './reports/htmlReports',

      }],

// Options to be passed to Jasmine.
jasmineNodeOpts: {
    defaultTimeoutInterval: 500000
 },

onPrepare: function () {  

  jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
              savePath: 'testreports',
              consolidate: true,
              useDotNotation: true
          })); 

  return global.browser.getProcessedConfig().then(function (config) {

  });
}, 


    params: {
          login: {
          Url:'https://w3-nonprod-platform-xxxx-xxxx.xxxxxxx.xxx.com'

        }
        },
};

Package.json:

{
  "name": "cogSol-e2e-test",
  "version": "1.0.0",
  "description": "",
  "main": "SanityConf.js",
  "dependencies": {
    "extend": "^3.0.0",
    "jasmine-reporters": "^2.2.1",
    "jasmine2-protractor-utils": "^1.3.0",
    "path": "^0.12.7",
    "protractor": "<5.4.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "license": "license.txt"
}

我注意到问了类似的问题(Protractor - Error: Failed: WebDriverError),但是该解决方案不适用于我的情况,所以我再次询问。

0 个答案:

没有答案