0% found this document useful (0 votes)
16 views1 page

Second Day

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Second Day

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package Automation;

import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;

public class SecondDay {

public static void main(String[] args) throws InterruptedException {


// TODO Auto-generated method stub
System.setProperty("webdriver,chrome.driver", "C:\\Selenuim\\
chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://demo.automationtesting.in/Alerts.html");
WebElement nav_simple, button1, nav_confirm, button2, nav_submission,
button3;
Alert alt;

nav_simple =
driver.findElement(By.xpath("/html/body/div[1]/div/div/div/div[1]/ul/li[1]/a"));
nav_simple.click();

button1 = driver.findElement(By.xpath("//*[@id=\"OKTab\"]/button"));
button1.click();

Thread.sleep(5000);

alt = driver.switchTo().alert();
alt.accept();

nav_confirm =
driver.findElement(By.xpath("/html/body/div[1]/div/div/div/div[1]/ul/li[2]/a"));
nav_confirm.click();

button2 =
driver.findElement(By.xpath("//*[@id=\"CancelTab\"]/button"));
button2.click();

Thread.sleep(5000);
alt.dismiss();

nav_submission =
driver.findElement(By.xpath("/html/body/div[1]/div/div/div/div[1]/ul/li[3]/a"));
nav_submission.click();
button3 = driver.findElement(By.xpath("//*[@id=\"Textbox\"]/button"));
button3.click();

Thread.sleep(5000);
driver.switchTo().alert().sendKeys("Hi,Archana Neupane");
driver.switchTo().alert().accept();
}

You might also like