0
吐司警報DOM結構的文本:使用獲得超時錯誤,而試圖獲取舉杯警報
<uib-alert id="alert-message-0" class="cs-toast-alert ng-binding ng-scope" ng-repeat="alert in headerModel.alerts()" type="success"
close="" ng-style="{bottom: (((headerModel.alerts().length - $index) * 70) - 48) + 'px'}"
ng-bind-html="headerModel.trustAsHtml(alert.msg)" style="bottom: 22px;">Successfully completed discharge</uib-alert>
方法是:
var EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf(element(by.id("alert-message-0"))),8000).then(function() {
return element(by.id('alert-message-0')).getAttribute('innerText').then(function (ttmessage) {
expect(ttmessage).toContain('Successfully completed discharge');
//browser.ignoreSynchronization = false;
});
});
四處錯誤: - 失敗:等待8856ms後超時
首先感謝。嘗試使用您提示接收錯誤的選項失敗:無法讀取最終未定義的屬性 –
將最後一行更改爲:'return expect(element(by.css('uib-alert')).getText())。to.eventually .equals('成功完成排放');' – Kacper