問題描述
我正在嘗試使用預期條件函數讓量角器在繼續之前等待頁面上存在項目.
http://angular.github.io/protractor/#/api?view=ExpectedConditions
我已按照文檔中的示例進行操作,但收到有關未定義屬性的錯誤.
這似乎是使用任何預期條件時的情況,而不僅僅是與我在這里使用的 presentOf 函數有關:
var EC = protractor.ExpectedConditionsvar pixel = element.all(by.repeater('item in items'))var pixelLoaded = EC.presenceOf(pixels)browser.wait(pixelsLoaded,10000)
<塊引用>
失敗:無法讀取未定義的屬性綁定"堆:TypeError:無法讀取未定義的屬性綁定"在 [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)在/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/jasminewd2/index.js:95:14在 [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].promise.ControlFlow.runEventLoop_ (/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1755:8)在 [對象對象].(/foo/bar/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2056:12)在 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)在 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)
通過移除對 all
的不當調用來修復:
var 像素 = element(by.repeater('item in items'));
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.
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)
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)
Fixed by removing the improper call to all
:
var pixels = element(by.repeater('item in items'));
這篇關于使用預期條件時未定義的屬性“綁定"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!