gpt4 book ai didi

javascript - Protractor by.repeater 找不到任何东西

转载 作者:行者123 更新时间:2023-11-30 12:20:07 25 4
gpt4 key购买 nike

如何用 Protractor 选择跟随中继器?

<a ng-repeat="item in filteredItems = (items | filter:'abc')">{{item}}</a>

最佳答案

你应该使用 by.exactRepeater() .

调查 source code ,您可以看到 exactRepeater 检查转发器在“track by”、“|”之前的部分并作为”。这意味着您不能使用:

element.all(by.exactRepeater("item in filteredItems"));

但必须使用以下内容:

element.all(by.exactRepeater("item in filteredItems = (items"));

我同意,这看起来不是特别可读。在这里创建了一个问题:

更新:问题现在已在主干中修复(非常快,感谢@sjelin)。


并且,或者,您始终可以以通常的 selenium-ish 方式找到它:

element.all(by.css('a[ng-repeat^="item in filteredItems"]'));
element.all(by.xpath('//a[starts-with(@ng-repeat, "item in filteredItems")]'));

关于javascript - Protractor by.repeater 找不到任何东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31389521/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com