javascript - ExpectedConditions 在量角器中抛出错误
问题描述
我想在我的框架中实现 ExpectedConditions 但它抛出了一些我无法理解的错误。有人可以帮助我吗?
步骤定义
this.Then(/^Select Any Opty and click on New button$/, async () => {
cmBrowser.sleep(10000);
await cmBrowser.wait(EC.visibilityOf(await loginPO.optyList()),20000);
var list=await loginPO.optyList();
});
页面对象
this.optyList = function () {
// return $$("table[role='grid'] th span a");
return element.all(by.xpath("//a/ancestor::th[@scope='row']"));
}
错误日志
TypeError: Cannot read property 'bind' of undefined
at ProtractorExpectedConditions.presenceOf (C:\Users\srongala\AppData\Roaming\npm\node_modules\protractor\built\expectedConditions.js:341:40)
at ProtractorExpectedConditions.visibilityOf (C:\Users\srongala\AppData\Roaming\npm\node_modules\protractor\built\expectedConditions.js:381:30)
at World.(anonymous) (C:\Users\srongala\Documents\My Received Files\Automation\Proc\Test_modules\step_definitions\PGS_ES.js:47:39)
at runMicrotasks ((anonymous))
at processTicksAndRejections (internal/process/task_queues.js:93:5)
我正在使用的应用程序是非角度应用程序..我查看了其他问题中提供的解决方案,他们说需要使用browser.ignoreSynchronization=true
,但我尝试了两者browser.waitForAngularEnabled();
,并且browser.ignoreSynchronization=true
两者都不起作用。
解决方案
visibilityOf()
accept ElementFinder
, not ElmentFinderArray
,你不应该传入元素数组。
this.Then(/^Select Any Opty and click on New button$/, async () => {
cmBrowser.sleep(10000);
await cmBrowser.wait(EC.visibilityOf(await loginPO.optyList().first()),20000);
var list=await loginPO.optyList();
});
推荐阅读
- python - WxPython:“App”对象没有属性“Mainloop”
- javascript - window.onscroll 和 window.addEventListener 有什么区别
- inheritance - Coq 集继承
- laravel - 升级到 Backpack 4.0 导致视图问题
- arduino - Arduino处理多个文件顺序问题
- java - 查询时 java 上的 Scape %
- git - Windows 10 上 Intellij 的 GIT 终端中的自动完成分支名称
- c - 更新结构数组中的字段
- python - 为什么 conda 环境不能在不重新下载的情况下使用来自 base 的包?
- glsl - 如何使用着色器控制顶点之间的颜色?