-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckBoxes.java
More file actions
70 lines (56 loc) · 1.64 KB
/
CheckBoxes.java
File metadata and controls
70 lines (56 loc) · 1.64 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
package Tests;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class CheckBoxes {
private static WebDriver driver = null;
public static String browserName = null;
@BeforeTest
public void setUp() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
@Test
public void testingAB() {
// Go to the page of dummy Website
driver.get("http://the-internet.herokuapp.com");
// Click the check boxes link
driver.findElement(By.xpath("//*[@id=\"content\"]/ul/li[6]/a")).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Checking the unchecked box
driver.findElement(By.xpath("//*[@id=\"checkboxes\"]/input[1]")).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Unchecking the checked box
driver.findElement(By.xpath("//*[@id=\"checkboxes\"]/input[2]")).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@AfterTest
public void tearDown() {
driver.close();
driver.quit();
System.out.println("Tested successfully");
}
}