未定义的属性' bind'使用预期条件时

时间:2015-04-30 13:39:24

标签: javascript angularjs webdriver protractor

我试图使用预期条件功能让量角器在继续之前等待页面上的项目存在。

http://angular.github.io/protractor/#/api?view=ExpectedConditions

我已经按照文档中的示例进行操作,但是我收到有关未定义属性的错误。

使用任何预期条件时似乎都是这种情况,而不仅仅是我在这里使用的presenceOf函数:

var EC = protractor.ExpectedConditions
var pixels = element.all(by.repeater('item in items'))
var pixelsLoaded = EC.presenceOf(pixels)

browser.wait(pixelsLoaded,10000)
  

失败:无法读取属性' bind'未定义的     堆:       TypeError:无法读取属性' bind'未定义的           at [object Object] .ExpectedConditions.presenceOf(/foo/bar/node_modules/gulp-protractor/node_modules/protractor/lib/expectedConditions.js:233:33)           在环境。 (/foo/bar/app/features/pixelmanager/test/pixelManagerPOTest.js:48:31)           at /foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/jasminewd2/index.js:95:14           at [object Object] .promise.ControlFlow.runInFrame_(/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)           at [object Object] .promise.ControlFlow.runEventLoop_(/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1755:8)           在[object Object]。 (/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2056:12)           at goog.async.run.processWorkQueue(/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/run.js:125:21)           在runMicrotasksCallback(node.js:337:7)           at process._tickCallback(node.js:355:11)       发件人:任务:在控制流程中运行它           在对象。 (/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/jasminewd2/index.js:94:33)       ====异步任务====       错误           在套房。 (/foo/bar/app/features/pixelmanager/test/pixelManagerPOTest.js:44:5)           在对象。 (/foo/bar/app/features/pixelmanager/test/pixelManagerPOTest.js:9:1)           在Module._compile(module.js:460:26)           在Object.Module._extensions..js(module.js:478:10)           在Module.load(module.js:355:32)           在Function.Module._load(module.js:310:12)

1 个答案:

答案 0 :(得分:9)

通过删除对all的错误调用来修复:

var pixels = element(by.repeater('item in items'));