How to handle popup in selenium webdriver
Here in this video tutorial you will learn How to handle popup in selenium webdriver and how to test popups in software testing
===== selenium script =====
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AlertPopUp {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(" http://www.services.irctc.co.in/");
driver.findElement(By.id("button")).click();
Alert alert = driver.switchTo().alert();
System.out.println(alert.getText());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
alert.dismiss();
}
}
------------------------------------------------------------------------------------------------------------
Please subscribe us:
https://www.youtube.com/c/EasyTutoria...
Like us on Facebook:
https://www.facebook.com/EasyTutorial...
Here in this video tutorial you will learn How to handle popup in selenium webdriver and how to test popups in software testing
===== selenium script =====
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AlertPopUp {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(" http://www.services.irctc.co.in/");
driver.findElement(By.id("button")).click();
Alert alert = driver.switchTo().alert();
System.out.println(alert.getText());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
alert.dismiss();
}
}
------------------------------------------------------------------------------------------------------------
Please subscribe us:
https://www.youtube.com/c/EasyTutoria...
Like us on Facebook:
https://www.facebook.com/EasyTutorial...
How to handle popup in selenium webdriver | Handle Alert Popup | |
11 Likes | 11 Dislikes |
7,936 views views | 57,381 followers |
Education | Upload TimePublished on 28 Apr 2015 |
No comments:
Post a Comment