无法使用量角器虚拟重复选择元素 [英] Not able to select an element using protractor virtual repeat

查看:48
本文介绍了无法使用量角器虚拟重复选择元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用 ng-repeat 选择一个元素,但开发人员使用了虚拟重复,因此以下代码现在不起作用

I was able to select an element using ng-repeat but the developers have used virtual repeat as such the following code does not work now

expect(stores.listStores(0).getText()).toContain('Prahran');
expect(element.all(by.repeater('store in ui.stores')).count()).toEqual(1);

失败:索引越界.尝试访问 index: 0 处的元素,但只有 0 个元素匹配定位器 by.repeater("store in ui.stores")

Failed: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator by.repeater("store in ui.stores")

推荐答案

你可以制作一个CSS选择器来匹配material design的repeater元素:

You can make a CSS selector to match the material design repeater elements:

element.all(by.css('[md-virtual-repeat="store in ui.stores"]'));

这篇关于无法使用量角器虚拟重复选择元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆