本文介绍了量角器 - 错误:失败:WebDriverError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个量角器项目,它按照我的预期启动并运行规范,但在将近 2 分钟后,它开始在其余测试用例中出现此错误.我不知道为什么.一周前它运行得很好,但现在我遇到了那个错误,它没有提供(或我看不到)关于错误的任何细节.

"错误:失败:WebDriverError在堆栈 (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\jasmine-core\\lib\\jasmine-core\\jasmine.js:2200:17)在 buildExpectationResult (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\jasmine-core\\lib\\jasmine-core\\jasmine.js:2170:14)在 Spec.expectationResultFactory (Z:\\dev\\lmw\\node_modules\\protractor\\node_modules\\jasmine-core\\lib\\jasmine-core\\jasmine.js:777:18)在 Spec.addExpectationResult (Z:\\dev\\lmw\\node_modules\\protractor\\node_modules\\jasmine-core\\lib\\jasmine-core\\jasmine.js:450:34)在 Env.fail (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\jasmine-core\\lib\\jasmine-core\\jasmine.js:1192:25)在 Function.next.fail (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\jasmine-core\\lib\\jasmine-core\\jasmine.js:4046:19)在 Z:\\dev\\lmw\node_modules\\protractor\node_modules\\jasminewd2\\index.js:64:48在 ControlFlow.emit (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\selenium-webdriver\\lib\\events.js:62:21)在 ControlFlow.shutdown_ (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\selenium-webdriver\\lib\\promise.js:2565:10)在 shutdownTask_.MicroTask (Z:\\dev\\lmw\node_modules\\protractor\node_modules\\selenium-webdriver\\lib\\promise.js:2490:53)"

项目信息:运行两个浏览器,使用chromedriver_2.31.exe.

protractor.conf.js=>

directConnect:假,splitTestsBetweenCapabilties: 真,多能力:[{shardTestFiles: 假,最大实例数:1,最大会话数:1,顺序:真实,并行能力:真,浏览器名称:'铬',眼镜: ['./tests/login/*.js','./tests/header/*.js','./tests/my-profile/*.js','./tests/nominee/*.js','./tests/left-menu/*.js','./tests/contact-us/*.js','./tests/relations/*.js','./tests/coordinator/*.js','./tests/sitemap/*.js','./tests/landing/*.js','./tests/vouchers/*.js','./tests/extend/*.js','./tests/activity/*.js']},{shardTestFiles: 假,最大实例数:1,最大会话数:1,顺序:真实,并行能力:真,浏览器名称:'铬',眼镜: ['./tests/enrollment/*.js','./tests/claim-/*.js','./tests/transfer/*.js','./tests/donate/*.js','./tests/buy/*.js','./tests/calculator/*.js']}]

package.json =>{开发依赖":{"grunt-cli": "^1.2.0","grunt-protractor-runner": "^4.0.0","jasmine-spec-reporter": "^3.2.0","量角器": "^5.0.0",茉莉花记者":^2.0.0"}}

解决方案

如果您使用的是办公笔记本电脑,请检查它是否在系统中进行了加密.这些加密很少会破坏节点模块,从而导致测试用例失败.

这是我能猜到的唯一原因,因为您之前运行了所有测试用例

PS:我遇到了同样的问题

I have a protractor project that It starts and runs specs as I expect but after almost 2 minutes it starts getting this error on rest of test cases. I don't know why. It had run perfectly one week ago but now I faced that error and it doesn't give (or I can't see) any detail about error.

Information about project: it runs two browser and using chromedriver_2.31.exe.

protractor.conf.js=>

directConnect: false,splitTestsBetweenCapabilties: true,multiCapabilities:[ { shardTestFiles: false, maxInstances: 1, maxSessions: 1, sequential: true, parallelCapability: true, browserName: 'chrome', specs: [ './tests/login/*.js', './tests/header/*.js', './tests/my-profile/*.js', './tests/nominee/*.js', './tests/left-menu/*.js', './tests/contact-us/*.js', './tests/relations/*.js', './tests/coordinator/*.js', './tests/sitemap/*.js', './tests/landing/*.js', './tests/vouchers/*.js', './tests/extend/*.js', './tests/activity/*.js' ] }, { shardTestFiles: false, maxInstances: 1, maxSessions: 1, sequential: true, parallelCapability: true, browserName: 'chrome', specs: [ './tests/enrollment/*.js', './tests/claim-/*.js', './tests/transfer/*.js', './tests/donate/*.js', './tests/buy/*.js', './tests/calculator/*.js' ] } ]

package.json =>{ "devDependencies": { "grunt-cli": "^1.2.0", "grunt-protractor-runner": "^4.0.0", "jasmine-spec-reporter": "^3.2.0", "protractor": "^5.0.0", "jasmine-reporters": "^2.0.0" }}

解决方案

if you are using your office laptop ,can you check whether it has any encryption in the system. Few of these encryptions corrupt the node modules , which results in the failure of the test cases.

This is the only reason I could guess since you ran all your test cases earlier

PS : I faced the same issue

这篇关于量角器 - 错误:失败:WebDriverError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 15:38