1
條件在我的應用我想通過使用它的名字和所有者名稱來選擇特定的通知。我如何在量角器中做到這一點? 我增加了截圖,我想從列表中選擇通知「由SONAL達拉爾測試Auction1」。 第二個屏幕顯示的通知 「測試Auction1由SONAL達拉爾」 我曾嘗試下面的規範文件中的代碼頁代碼如何識別特定的元素與兩個期望量角器
:
Auction.AuctionNotiNewInv.isDisplayed().then(function(){
Auction.NotificationTitle.get(0).isDisplayed().then(function(){
Auction.NotificationTitle.count().then(function(Count){
console.log(Count);
var NotifTitleCount = Count;
for(var i=0; i < NotifTitleCount; i++) {
Auction.NotificationTitle.get(i).isDisplayed().then(function(){
Auction.NotifAuctioneer.isDisplayed().then(function(IsDisplayed){
if(IsDisplayed)
Auction.NotificationTitle.get(i).click();
else
console.log('New Auction invitation is not displayed.');
});
});
}
});
});
});
和PO文件如下圖所示:
this.AuctionNotiNewInv = element(by.cssContainingText('.md-subheader-inner','NEW INVITATIONS'));
this.NotificationTitle = element.all(by.cssContainingText('.title.ng-binding',data.AuctionName));
this.NotifAuctioneer = element(by.cssContainingText('.subtitle.ng-binding',data.NewFirstName + ' ' + data.NewLastName));
但上面的代碼返回我數= 4,因爲有它有「NotificationTitle」的同一屬性頁面上的其他對象,但它不是通知列表的一部分。 有人建議我另一種方式來處理這個問題用期待的功能?
非常感謝,它爲我工作。 –