-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestNgxml2.java
65 lines (56 loc) · 1.86 KB
/
TestNgxml2.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
package TestNg;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class TestNgxml2 {
WebDriver driver;
@Test(priority=1,groups="SmokeTesting")
public void launchbrowser()
{
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.get("https://www.w3schools.com/");
driver.manage().window().maximize();
System.out.println("SmokeTest Completed");
}
@Test(priority=2,groups="FunctionalTesting")
public void verifytitle()
{
driver = new ChromeDriver();
driver.get("https://www.w3schools.com/");
driver.manage().window().maximize();
String atitle = driver.getTitle();
Assert.assertEquals("W3Schools Online Web Tutorials", atitle);
System.out.println("FunctionalTesting Passed");
}
@Test(priority=3,groups="FunctionalTesting")
public void Enterthevaalue()
{
driver = new ChromeDriver();
driver.get("https://www.w3schools.com/");
driver.manage().window().maximize();
driver.findElement(By.xpath("//*[@id=\"search2\"]")).sendKeys("Typing Test");
System.out.println("FunctionalTesting Passed");
}
@Test(priority=4,groups="FunctionalTesting")
public void clickthebutton()
{
driver = new ChromeDriver();
driver.get("https://www.w3schools.com/");
driver.manage().window().maximize();
driver.findElement(By.xpath("//*[@id=\"search2\"]")).sendKeys("Typing Test");
driver.findElement(By.id("learntocode_searchbtn")).click();
System.out.println("FunctionalTesting Passed");
}
@Test(priority=5,groups="SanityTesting")
public void closethebrowser()
{
driver = new ChromeDriver();
driver.get("https://www.w3schools.com/");
driver.manage().window().maximize();
driver.close();
}
}