-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomePage.java
More file actions
57 lines (48 loc) · 1.45 KB
/
HomePage.java
File metadata and controls
57 lines (48 loc) · 1.45 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
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
/**
* @author Bojan
* This is an intermediate class that
* allows to chose the user or agent interface
*/
public class HomePage {
private WebDriver driver;
public HomePage(WebDriver driver) {
if(driver.getTitle().equals("My Questions")||driver.getTitle().equals("Invitations"))
this.driver = driver;
else
throw new IllegalStateException("This is not the home page:" + driver.getCurrentUrl());
}
/**
* This method opens the AgentHRPage or returns an object of it if it was
* already open. This method will throw an exception if the account does not
* have HR Admin permissions
* @return
*/
public AgentHRPage openAgentInterface()
{
if(driver.getTitle().equals("Invitations"))
return new AgentHRPage(driver);
else
{
driver.findElement(
By.xpath(".//*[@id='tblMain']/tbody/tr[1]/td[2]/table/tbody/tr/td[6]/img"))
.click();
driver.findElement(By.id("popupAccount_lnkAgentInterface")).click();
return new AgentHRPage(driver);
}
}
public UserGettingStartedPage openUserInterface()
{
if(driver.getTitle().equals("My Questions"))
return new UserGettingStartedPage(driver);
else
{
driver.findElement(
By.xpath(".//*[@id='tblMain']/tbody/tr[1]/td[2]/table/tbody/tr/td[6]/img"))
.click();
driver.findElement(By.id("popupAccount_lnkEmployeeInterface")).click();
return new UserGettingStartedPage(driver);
}
}
}