forked from naveenanimation20/SeleniumJavaCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoogleTest.java
More file actions
75 lines (55 loc) · 1.56 KB
/
GoogleTest.java
File metadata and controls
75 lines (55 loc) · 1.56 KB
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
72
73
74
75
package com.test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class GoogleTest {
WebDriver driver;
//1 //4 //7
@BeforeMethod
public void setUp(){
System.setProperty("webdriver.chrome.driver", "/Users/naveenkhunteta/Downloads/chromedriver");
driver = new ChromeDriver(); //launch chrome
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("http://www.google.com");
}
//2
@Test(priority=1,groups="Title")
public void googleTitleTest(){
String title = driver.getTitle();
System.out.println(title);
}
//8
@Test(priority=3,groups="Logo")
public void googleLogoTest(){
boolean b = driver.findElement(By.xpath("//*[@id='hplogo']")).isDisplayed();
}
//5
@Test(priority=2,groups="Link Test")
public void mailLinkTest(){
boolean b = driver.findElement(By.linkText("GMail")).isDisplayed();
}
@Test(priority=4,groups="Test")
public void test1(){
System.out.println("test1");
}
@Test(priority=5,groups="Test")
public void test2(){
System.out.println("test1");
}
@Test(priority=6,groups="Test")
public void test3(){
System.out.println("test1");
}
//3 //6 //9
@AfterMethod
public void tearDown(){
driver.quit();
}
}