我是Selenium webdriver的新手。有人可以帮我解决如何取消以下代码的提醒
<div id="popup1" class="k-window-content k-content" style="" data-role="window" tabindex="0" role="dialog" aria-labelledby="popup1_wnd_title">
<div class="popupWrap">
Policy violation
<div class="wrap-keyword">
Note
<textarea id="flagtxtnote" cols="50" rows="4"/>
<fieldset class="full-width">
<input id="btnflagcancel" class="more gray-theme" type="button" value="Flag" onclick="saveclick(4, 0);"/>
<input id="btnflagsave" class="more icon-hat" type="button" value="Flag" onclick="saveclick(4, 1);"/>
</fieldset>
</div>
</div>
我试过下面的代码
try
{
//Handle the alert pop-up using seithTO alert statement
Alert alert = dr.switchTo().alert();
//Print alert is present
System.out.println("Alert is present");
//get the message which is present on pop-up
String message = alert.getText();
//print the pop-up message
System.out.println(message);
alert.sendKeys("");
//Click on OK button on pop-up
alert.accept();
}
catch (NoAlertPresentException e)
{
//if alert is not present print message
System.out.println("alert is not present");
}
输出显示(警报不存在)