-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecialLocatorsTest.java
32 lines (27 loc) · 983 Bytes
/
SpecialLocatorsTest.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 SpecialLocatorsTest {
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_findByCSSSelector() {
System.out.println(driver.findElement(By.cssSelector("div[value=en]")));
}
@Test
public void test02_findByXpath(){
System.out.println(driver.findElement(By.xpath("//textarea[@spellcheck='false' and @rows='1']")));
}
@AfterClass
public static void tearDown(){
driver.quit();
}
}