forked from saranyaeaswaran/SeleniumTesting
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDialogControl.java
More file actions
39 lines (30 loc) · 1.32 KB
/
Copy pathDialogControl.java
File metadata and controls
39 lines (30 loc) · 1.32 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
package allTests;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import resources.UITestPracticePage;
import utility.FrameworkConstants;
public class DialogControl {
public static void main(String[] args) {
System.setProperty(FrameworkConstants.CHROME_DRIVER_KEY,FrameworkConstants.CHROME_DRIVER_PATH);
WebDriver driver = new ChromeDriver();
driver.get("http://uitestpractice.com/Students/");
System.out.println(driver.getCurrentUrl());
UITestPracticePage.using(driver).dialogControl_createNewUser.click();
UITestPracticePage.using(driver).dialogControl_createNewUser_name.clear();
UITestPracticePage.using(driver).dialogControl_createNewUser_name.sendKeys("Jon Snow");
UITestPracticePage.using(driver).dialogControl_createNewUser_createAccount.click();
WebElement userTable = UITestPracticePage.using(driver).dialogControl_userTable;
List<WebElement> userRows = userTable.findElements(By.tagName("tr"));
for(WebElement userRow:userRows) {
List<WebElement> userData = userRow.findElements(By.tagName("td"));
for(WebElement user:userData) {
System.out.println(user.getText());
}
System.out.println("=============================");
}
driver.quit();
}
}