我遇到的情况是,当我单击页面元素时,它会显示一个弹出窗口,而当我单击当前弹出窗口的元素时,它会显示另一个带有“取消”和“删除”按钮的弹出窗口。在第一个弹出窗口中,我可以单击而无需切换,但是我不能单击第二个弹出窗口。
我得到的错误-
没有此类警报
我使用的代码-
driver.switchTo().alert().accept();
并且切换帧代码也不起作用。
这是html-
class="modal-backdrop in"></div>
<div class="modal in" id="headingDeletionConfirmationModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="display: block;">
div class="modal-dialog" role="document">
<form action="http://ad.ad.co.in/Assessment/deleteCoscholasticHeading" method="post">
<input type="hidden" id="heading_Id" value="48" name="heading_Id"> <input type="hidden" id="class_Id" value="7" name="class_Id"> <input type="hidden" id="year_Id" value="20" name="year_id">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Are you sure you want to
delete this Heading ?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Delete</button>
</div>
</div>
</form>
</div>
</div>
<div class="modal-dialog" role="document">
<form action="http://admin.ad.co.in/Assessment/deleteCoscholasticHeading" method="post">
<input type="hidden" id="heading_Id" value="48" name="heading_Id"> <input type="hidden" id="class_Id" value="7" name="class_Id"> <input type="hidden" id="year_Id" value="20" name="year_id">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Are you sure you want to
delete this Heading ?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Delete</button>
</div>
</div>
</form>
</div>
有帮助吗?