forked from naveenanimation20/SeleniumJavaCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoogleTitleTest.java
More file actions
56 lines (38 loc) · 1.23 KB
/
GoogleTitleTest.java
File metadata and controls
56 lines (38 loc) · 1.23 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
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.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class GoogleTitleTest {
WebDriver driver;
@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");
}
@Test()
public void googleTitleTest(){
String title = driver.getTitle();
System.out.println(title);
Assert.assertEquals(title, "Google123", "title is not matched");
}
@Test()
public void googleLogoTest(){
boolean b = driver.findElement(By.xpath("//*[@id='hplogo']")).isDisplayed();
Assert.assertTrue(b);
Assert.assertEquals(b, true);
}
@AfterMethod
public void tearDown(){
driver.quit();
}
}