Handling Alert in Selenium WebDriver (Selenium 2)

前端 未结 7 1302
后悔当初
后悔当初 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:08

    C# code:

    IAlert alert = driver.SwitchTo().Alert();
    alert.Accept(); 
    System.Threading.Thread.Sleep(milliseconds);
    

提交回复
热议问题