-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestNgAnnotations8.java
71 lines (59 loc) · 1.76 KB
/
TestNgAnnotations8.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package TestNg;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.testng.annotations.BeforeClass;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
public class TestNgAnnotations8 {
WebDriver driver;
@BeforeClass
public void ApptestStarted()
{
System.out.println("Testing started");
}
@Test(priority=1)
public void launchbrowser()
{
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.manage().window().maximize();
}
@Test(priority=2)
public void verifytitle()
{
driver.get("https://demo.guru99.com/telecom/addcustomer.php");
String atitle = driver.getTitle();
Assert.assertEquals("Guru99 Telecom Add Customer", atitle);
System.out.println("Test case passed");
}
@Test(priority=3)
public void EnteringValuesintextBox() throws InterruptedException
{
driver.get("https://demo.guru99.com/telecom/addcustomer.php");
driver.findElement(By.xpath("//*[@id=\"main\"]/div/form/div/div[1]/label")).click();
Thread.sleep(2000);
driver.findElement(By.id("fname")).sendKeys("Vinay");
driver.findElement(By.id("lname")).sendKeys("Kumar");
Thread.sleep(2000);
driver.findElement(By.id("email")).sendKeys("salkattevinay@gmail.com");
Thread.sleep(2000);
driver.findElement(By.id("telephoneno")).sendKeys("9999999999");
Thread.sleep(2000);
driver.findElement(By.name("submit")).click();
driver.switchTo().alert().accept();
System.out.println("Test Case Passed");
}
@Test(priority=4)
public void Closethebrowser()
{
driver.close();
}
@AfterClass
public void AppTestended()
{
System.out.println("Testing ended");
}
}