如何在 Protractor 中扩展 protractor.ExpectedConditions
?
我尝试了一种类似的方法来扩展 ElementFinder
:
function myFunction(elementFinder){
function clientScript(e){
return someCondition(e);
}
return () => browser.executeScript(clientScript, elementFinder.getWebElement());
}
protractor.ExpectedConditions.prototype.myFunction = myFunction;
但它失败了:
"E/launcher - Error: TypeError: Cannot set property 'myFunction' of undefined"
我确实注意到通过分配 protractor.ExpectedConditions.myFunction
它似乎可以工作,但是这样做安全吗?
最佳答案
yes its fault in your code, first define this
protractor.ExpectedConditions
那么你就不能面对那个错误了。
关于javascript - 如何在 Protractor 中扩展 ExpectedConditions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54143411/