我正在尝试使用Selenium (java)单击警报弹出消息上的Yes/No按钮。我知道我们有 accept() 函数来单击任何警报的Ok按钮,但这在这种情况下不起作用。我尝试了以下代码:Alert alert = driver.switchTo().alert();alert.accept();这是警报消息的 HTML 代码:<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"> <div class="ui-dialog-buttonset"> <button type="button" class="ui-button ui-widget ui-state-default ui-corner- all ui-button-text-only" role="button" aria-disabled="false"> <span class="ui-button-text">Yes</span> </button> <button type="button" class="ui-button ui-widget ui-state-default ui-corner- all ui-button-text-only" role="button" aria-disabled="false"> <span class="ui-button-text">No</span> </button></div></div>请帮忙!
添加回答
举报
0/150
提交
取消