Selenium WebDriver with Java: Can't accept alert
问题 When recording in selenium IDE I can click the "OK" button in a popup, and expected to be able to click it using driver.findElement(By.linkText("OK")).click(); but this was not the case. Similarly this doesn't work. driver.switchTo().alert().accept(); Selenium throws a NoAlertPresent exception. If what's popping up is not an alert, then what is it? And how do I click yes! 回答1: in such case I'd prefer to check(verify) the alert presence on the page and then if is present - accept it. It be