使用预期条件时未定义属性'bind' [英] undefined property 'bind' when using expected conditions

查看:64
本文介绍了使用预期条件时未定义属性'bind'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用预期条件函数让量角器在继续之前等待页面上项目的存在。

I'm trying to use the expected conditions function to make protractor wait for the presence of items on a page before continuing.

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

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

I have followed the example in the docs, but I am getting an error about an undefined property.

这似乎是当使用任何预期条件时,不仅仅与我在这里使用的presenceOf函数有关:

This seems to be the case when using any expected condition, not just related to the presenceOf function I am using here:

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

browser.wait(pixelsLoaded,10000)




失败:无法读取未定义$ b的属性'bind' $ b Stack:
TypeError:无法读取未定义
的属性'bind'[o bject Object] .ExpectedConditions.presenceOf(/foo/bar/node_modules/gulp-protractor/node_modules/protractor/lib/expectedConditions.js:333:33)
at Env。 (/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)$ object $ [。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)
at 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)
at Object。 (/foo/bar/app/features/pixelmanager/test/pixelManagerPOTest.js:9:1)
在Module._compile(module.js:460:26)
at Object.Module._extensions。 .js(module.js:478:10)
在Module.load(module.js:355:32)
在Function.Module._load(module.js:310:12)

Failed: Cannot read property 'bind' of undefined Stack: TypeError: Cannot read property 'bind' of undefined at [object Object].ExpectedConditions.presenceOf (/foo/bar/node_modules/gulp-protractor/node_modules/protractor/lib/expectedConditions.js:233:33) at Env. (/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) at [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) at runMicrotasksCallback (node.js:337:7) at process._tickCallback (node.js:355:11) From: Task: Run it in control flow at Object. (/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/jasminewd2/index.js:94:33) ==== async task ==== Error at Suite. (/foo/bar/app/features/pixelmanager/test/pixelManagerPOTest.js:44:5) at Object. (/foo/bar/app/features/pixelmanager/test/pixelManagerPOTest.js:9:1) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12)


推荐答案

通过删除对的所有:

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

这篇关于使用预期条件时未定义属性'bind'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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