-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXPathIndex.java
More file actions
52 lines (45 loc) · 1.57 KB
/
Copy pathXPathIndex.java
File metadata and controls
52 lines (45 loc) · 1.57 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
package seleniumtest;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import java.io.BufferedReader;
import java.io.FileReader;
import java.sql.Time;
import java.time.Duration;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.Alert;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import io.github.bonigarcia.wdm.WebDriverManager;
public class XPath {
WebDriver driver;
@BeforeTest
public void setup() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
@Test
public void fillForm() throws InterruptedException {
driver.get("https://www.techlistic.com/p/selenium-practice-form.html");
driver.findElement(By.xpath("(//input[@type='text'])[1]"))
.sendKeys("Kishore");
driver.findElement(By.xpath("(//input[@type='text'])[2]"))
.sendKeys("Char");
Thread.sleep(2000);
}
@AfterTest
public void tearDown() {
driver.quit();
}
}