我能够使用 ng-repeat 选择一个元素,但开发人员使用了虚拟重复,因此以下代码现在不起作用
expect(stores.listStores(0).getText()).toContain('Prahran');
expect(element.all(by.repeater('store in ui.stores')).count()).toEqual(1);
失败:索引超出范围。尝试访问索引为 0 处的元素,但只有 0 个元素与 locator by.repeater("store in ui.stores") 匹配
最佳答案
您可以制作一个 CSS 选择器来匹配 Material Design 重复器元素:
element.all(by.css('[md-virtual-repeat="store in ui.stores"]'));
关于javascript - 无法选择元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50390830/