2

|

    1

    2

    try {
        driver.switchTo().alert();
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    try {
        driver.switchTo().alert().accept();
    } catch (Exception e) {
        e.printStackTrace();
    }
    
    |