我正在进行自动化测试,用户点击出价并点击“出价”按钮,点击按钮后会出现一个弹出窗口。我想添加一个Expect语句来测试弹出窗口是否出现但是当我运行spec文件时出现no element found using locator
错误。
这是HTML
<ai-dialog class="au-target" au-target-id="268">
<ai-dialog-header class="au-target" au-target-id="269">
<div class="dialog-header-content">
<h4 class="modal-title">Confirm Bid</h4><!--slot-->
</div>
</ai-dialog-header><ai-dialog-body class="au-target" au-target-id="270">
<div class="text-md m-b-lg _500">
Are you sure you want to want to apply the following bid?
</ai-dialog-body><ai-dialog-footer class="au-target" au-target-id="275">
<button class="primary au-target" click.trigger="ok()" au-target-id="276">Ok</button><button class="btn-danger au-target" click.trigger="cancel()" au-target-id="277">Cancel</button>
</ai-dialog-footer>
</ai-dialog>
placeBidButton.click();
browser.sleep(500);
expect(element(by.name('<ai-dialog class="au-target" au-target-id="268">')).isDisplayed()).toBeTruthy();
当我运行测试时,会出现弹出窗口。 谢谢你的帮助