这样的日志可能吗?
07-<...>.js
...
Stacktrace: [31m[31mError: Failed expectation[31m
[31m at [object Object].<anonymous> (...06-....js)[31m[31m[22m[39m
所以,当我在套件中处理文件-07-时,它基本上在文件-06-中失败了。
是否可以选择对量角器/ webdriver.js说“嘿不等待以前的承诺得到解决”?我想不是,但也许有一种已知的情况可能会发生这种情况。
抱歉这些小信息。我无法提供更多信息。
这是一个类似的问题,我认为它与之前的问题有关:
[32m46 tests, 11 assertions, 0 failures
[39m
[launcher] BUG: launcher exited with 1 tasks remaining
我有另一个案例,我有一个错误stacktrace -after-测试,断言和失败行。 EJ:
032 - "alert.msg" equals text: "invalid login"[32m✔[39m 033 - set detailTestLevel: 1
Finished in 3 seconds. Speed: 12.89 tests per second
Last Test Id: (ch_loginvalid_enUS_122_01)
[32m33 tests, 0 assertions, 0 failures
[39m
sh: 1: beep: not found
/home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654
var result = fn();
^
Error: Index out of bound. Trying to access element at index:0, but there are only 0 elements
at /home/*******/common/ext/ElementFinder.js:618:15
at /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at [object Object].then /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:522:7)
at Object.webdriver.promise.asap /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:767:11)
at newFrame.onComplete /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1670:25)
at [object Object].webdriver.promise.Frame_.notify_ /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1914:5)
at [object Object]._onTimeout /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1901:11)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Error
at [object Object].ElementArrayFinder.applyAction_ (/home/*******/node_modules/protractor/lib/element.js:390:21)
at [object Object].self.(anonymous function) [as getText] /home/*******/node_modules/protractor/lib/element.js:77:19)
at [object Object].self.(anonymous function) [as getText] /home/*******/node_modules/protractor/lib/element.js:698:11)
at [object Object].<anonymous> (/home/*******/common/ext/ElementFinder.js:512:16)
at flow.execute.then.webdriverFailure (/home/*******/node_modules/jasminewd-retry/index.js:146:18)
at [object Object].promise.ControlFlow.runInFrame_ /home/*******/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
at [object Object].promise.ControlFlow.runEventLoop_ /home/*******/node_modules/selenium-webdriver/lib/webdriver/promise.js:1755:8)
at [object Object].<anonymous> (/home/*******/node_modules/selenium-webdriver/lib/webdriver/promise.js:2056:12)
at [object Object].goog.async.run.processWorkQueue [as _onTimeout] /home/*******/node_modules/selenium-webdriver/lib/goog/async/run.js:125:21)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
[launcher] Process exited with error code 1
是否存在可能发生这种情况的情况?
量角器版本:1.7
节点版本:0.10.25
这是ElementFinder的代码:512:
ElementFinder.prototype.itEqualsText = function(name, text) {
if (_.isNully(text)) { text = name; name = this.originalName; };
var elm = this; name = name || this.originalName;
if (_.isNully(name)) throw new Error('needs name');
if (_.isNully(text)) throw new Error('needs text');
// This helps with stack traces after rit (retry it) timeouts.
// If you attempt to build the trace within an it() block you
// lose the whole trace because of the way Jasmine build the tests.
rit('"' + name + '" equals text: "' + text + '"', function() {
expect(elm.waitReady()).toBeTruthy();
expect(elm.getText()).toEqual(text); // line 512
});
};
这是ElementFinder的代码:618:
// Fix current Protractor implementation so it keeps a reference to the
// original index as it was on previous Protractor versions: i.e. <= 1.2.0
ElementArrayFinder.prototype.get = function(index) {
var self = this;
var getWebElements = function() {
return self.getWebElements().then(function(parentWebElements) {
var i = index;
if (i < 0) {
// wrap negative indices
i = parentWebElements.length + i;
}
if (i < 0 || i >= parentWebElements.length) {
throw new Error('Index out of bound. Trying to access element at ' + // line 618
'index:' + index + ', but there are only ' +
parentWebElements.length + ' elements');
}
return [parentWebElements[i]];
});
};
getWebElements.with_index_ = index; // added
return new ElementArrayFinder(this.ptor_, getWebElements, this.locator_).
toElementFinder_();
};
我对这段代码感到满意,所以我不是100%的代码。我认为它从element.all(“...”)得到一个数组索引.get(x)。
答案 0 :(得分:1)
最后,我找到了解决方案。
Protractor 1.7附带selenium-webdriver作为依赖。
因此,如果您使用selenium-webdriver作为依赖项,并且由于X原因无法避免,请确保package.json中的selenium-webdriver版本与Protractor的package.json中的版本相同(在这种情况下,2.44.0)。