-
Notifications
You must be signed in to change notification settings - Fork 0
/
StudentDetailsPage.java
65 lines (44 loc) · 1.48 KB
/
StudentDetailsPage.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
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
/********************************************************************
* File Name: StudentDetailsPage.java
*
* Date Created: 02-Nov-2019
*
* ------------------------------------------------------------------
*
* Copyright (c) 2019 ajeydudhe@gmail.com
*
*******************************************************************/
package org.expedientframework.uitest;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class StudentDetailsPage {
public String getStudentId() {
return getValue(this.studentIdElement);
}
public String getFirstName() {
return getValue(this.firstNameElement);
}
public String getLastName() {
return getValue(this.lastNameElement);
}
public int getAge() {
return Integer.parseInt(getValue(this.ageElement));
}
public String getWelcomeMessage() {
return getValue(this.welcomeMessageIdElement);
}
private static String getValue(final WebElement webElement) {
return webElement.getTagName().equalsIgnoreCase("input") ? webElement.getAttribute("value") : webElement.getText();
}
// Private members
@FindBy(id = "welcomeMessage")
private WebElement welcomeMessageIdElement;
@FindBy(id = "studentId")
private WebElement studentIdElement;
@FindBy(id = "firstName")
private WebElement firstNameElement;
@FindBy(id = "lastName")
private WebElement lastNameElement;
@FindBy(id = "age")
private WebElement ageElement;
}