import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AlertPopup {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\Mutturaj\\Downloads\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://mail.rediff.com/cgi-bin/login.cgi");
driver.findElement(By.name("proceed")).click();
Alert alert = driver.switchTo().alert();
System.out.println(alert.getText());
alert.accept();
// other importent methods
/*
* alert.getText() alert.dismiss(); alert.sendKeys("text");
*/
}
}
Showing posts with label alert. Show all posts
Showing posts with label alert. Show all posts
Friday, March 8, 2019
Handling Alert in selenium
Subscribe to:
Posts (Atom)