Handling Alert in Selenium WebDriver (Selenium 2)

前端 未结 7 1307
后悔当初
后悔当初 2020-12-16 04:26
driver.findElement(By.xpath(\"//input[@value=\'添加\']\")).click(); 
//Pops out an Alert and program stops, does not continue 

how to click the alert

7条回答
  •  长情又很酷
    2020-12-16 05:10

    As of the latest selenium 2 release, this can be done (at least using the FirefoxDriver):

        driver.switchTo().alert().accept();
    

提交回复
热议问题