-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathHomePage.java
42 lines (34 loc) · 1.19 KB
/
HomePage.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
package pages;
import enums.Url;
import org.openqa.selenium.By;
import utils.CommonUtils;
/**
* Created by tmaher on 12/21/2015.
*/
public class HomePage extends CommonUtils {
private final By YOUR_ACCOUNT = By.id("nav-link-yourAccount");
private final By SHOPPING_CART_ICON = By.cssSelector("#nav-cart");
private final By SHOPPING_CART_COUNT = By.cssSelector("#nav-cart > #nav-cart-count");
public HomePage(){
}
public void navigateToHomePage() {
String url = Url.BASEURL.getURL();
System.out.println("Navigating to Amazon.com: " + url);
navigateToURL(url);
}
public void navigateToSignInPage(){
System.out.println("HOME_PAGE: Selecting [YOUR_ACCOUNT] in navigation bar.");
scrollToThenClick(YOUR_ACCOUNT);
System.out.println("HOME_PAGE: Navigating to the SIGNIN_PAGE.\n");
}
public void signOutWithSignOutLink(){
String url = Url.BASEURL.getURL() + Url.SIGNOUT.getURL();
navigateToURL(url);
}
public void selectShoppingCartIcon(){
click(SHOPPING_CART_ICON);
}
public String getNumberOfItemsListedInShoppingCartIcon(){
return getElementText(SHOPPING_CART_COUNT);
}
}