简体   繁体   English

单击量角器中的轮播图像

[英]Clicking through carousel image in protractor

I have a carousel image which varies depends on the customer GUID I am viewing. 我有一个轮播图片,该图片取决于我正在查看的客户GUID。 So far I have made this work. 到目前为止,我已经完成了这项工作。 But when I put that in the for loop, it is not working. 但是,当我将它放在for循环中时,它不起作用。

Here is my code: 这是我的代码:

var date = element(by.css('i.icon.left-arrow'));
browser.wait(EC.elementToBeClickable(date), 30000, "Date Range is still not clickable");
date.click(); // This works but this will go back only once.

I have this for loop: To identify all the elements and click through the image. 我有这个for循环:识别所有元素并单击图像。 Is this correct way of identifying in angular? 这是正确的角度识别方法吗? Please advise. 请指教。

var backArrow = element.all(by.css('i.icon.left-arrow'));
for (var i=0;i<backArrow.length;i++) {
    backArrow.click();
}

Here is the element: This depends on the customer I am viewing. 这里是元素:这取决于我正在查看的客户。 The images can vary anywhere between 1 to 50: 图像可以在1到50之间变化:

<i class="icon left-arrow"></i>

To apply a function to every element in the ElementArrayFinder , use each() : 要将函数应用于ElementArrayFinder每个元素,请使用each()

element.all(by.css('i.icon.left-arrow')).each(function (arrow) {
    arrow.click();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM