标签:
界面上如果有一个对话框可能弹出来,也可能不弹出,我们都要认为是正常,应该怎么处理呢?
/** * check if release notes dialog present * @author j */ public boolean isReleaseNotesDialogPresent(){ try{ new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#releaseNotes"))); return true; } catch(Exception e){ logger.info("There‘s no release notes dialog pop up"); return false; } } /** * check if release notes dialog present,if yes,close release notes dialog by click close button * @author j */ public void closeReleaseNotesDialog(){ boolean isDialogPresent=isReleaseNotesDialogPresent(); if(isDialogPresent==true){ SeleniumUtil.waitForElementPresent(driver, By.cssSelector("input#btnClose")).click(); } }
[Selenium]对于某些对话框即有可能弹出来,也有可能不弹出来,这种应该怎么处理呢?
标签:
原文地址:http://www.cnblogs.com/MasterMonkInTemple/p/4535607.html