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 AlertOk {
public WebDriver driver;
@Test
public void Alert()throws Exception {
driver.get("http://seleniumsubbu.blogspot.in/");
driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@id='node-100']/div/div[1]/div/div/button")).click();
Thread.sleep(5000);
driver.switchTo().alert().accept();
}
@BeforeTest
public void beforeTest() {
driver= new FirefoxDriver();
}
}
public WebDriver driver;
@Test
public void Alert()throws Exception {
driver.get("http://seleniumsubbu.blogspot.in/");
driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@id='node-100']/div/div[1]/div/div/button")).click();
Thread.sleep(5000);
driver.switchTo().alert().accept();
}
@BeforeTest
public void beforeTest() {
driver= new FirefoxDriver();
}
}