-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextLocatorsTest.java
32 lines (27 loc) · 954 Bytes
/
TextLocatorsTest.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
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class TextLocatorsTest {
private static WebDriver driver;
@BeforeClass
public static void runOnceBeforeClass() {
System.setProperty("webdriver.chrome.driver" , "C:\\Users\\dgotl\\Downloads\\chromedriver_win32\\ChromeDriver.exe");
driver = new ChromeDriver();
driver.get("https://translate.google.com");
}
@Test
public void test01_findElementByText() {
System.out.println(driver.findElement(By.linkText("History")));
}
@Test
public void test02_findElementByPartialText(){
System.out.println(driver.findElement(By.partialLinkText("Trans")));
}
@AfterClass
public static void tearDown(){
driver.quit();
}
}