import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
public class ConformationAlertCanel {
public WebDriver driver;
public WebDriver driver;
@Test
public void ConformationAlertBox()throws Exception {
driver.get("http://seleniumsubbu.blogspot.in/");
driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@id='node-102']/div/div[1]/div/div/button")).click();
Thread.sleep(5000);
//driver.switchTo().alert().accept();// accept means :click on "OK" option button
driver.switchTo().alert().dismiss(); // dismiss means : click on "Cancel" option button
}
public void ConformationAlertBox()throws Exception {
driver.get("http://seleniumsubbu.blogspot.in/");
driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@id='node-102']/div/div[1]/div/div/button")).click();
Thread.sleep(5000);
//driver.switchTo().alert().accept();// accept means :click on "OK" option button
driver.switchTo().alert().dismiss(); // dismiss means : click on "Cancel" option button
}
@BeforeTest
public void beforeTest() {
driver= new FirefoxDriver();
driver.manage().window().maximize();
}
}
public void beforeTest() {
driver= new FirefoxDriver();
driver.manage().window().maximize();
}
}