package testNG;
import org.junit.Test;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AlertGeneration {
WebDriver driver = new FirefoxDriver();
@Test
public void test () throws InterruptedException {
//Generating Alert Using Javascript Executor
JavascriptExecutor javascript = (JavascriptExecutor) driver;
javascript.executeScript("alert('Test Case Execution Is started Now..');");
Thread.sleep(2000);
driver.switchTo().alert().accept();
}
}
import org.junit.Test;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AlertGeneration {
WebDriver driver = new FirefoxDriver();
@Test
public void test () throws InterruptedException {
//Generating Alert Using Javascript Executor
JavascriptExecutor javascript = (JavascriptExecutor) driver;
javascript.executeScript("alert('Test Case Execution Is started Now..');");
Thread.sleep(2000);
driver.switchTo().alert().accept();
}
}
No comments:
Post a Comment