-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainPage.java
More file actions
63 lines (52 loc) · 1.87 KB
/
Copy pathMainPage.java
File metadata and controls
63 lines (52 loc) · 1.87 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
58
59
60
61
62
63
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import java.time.Duration;
public class MainPage {
WebDriver driver;
Actions doubleClickAction;
//constructor
public MainPage(WebDriver driver){
this.driver=driver;
doubleClickAction=new Actions(driver);
}
//locators
By changeCountryLoc=By.cssSelector("img.header-q6ti7y");
By toEnglishLoc=By.cssSelector("button.header-kpc5eh");
By toHebrewLoc=By.cssSelector("button.header-1k7b8zz");
By toShoppingBtnLoc=By.xpath("//*[@id=\"header-country-selector-wrapper\"]/div/div[3]/div/div[5]/button");
By myAccountLoc= By.cssSelector("span.header-riea5x");
By homeCategoryLoc = By.xpath("//*[@id=\"meganav-link-6\"]/div");
//methods
/**
* changeLanguageToHebrew: change language from English to Hebrew
*/
public void changeLanguageToHebrew(){
driver.findElement(changeCountryLoc).click();
driver.findElement(toHebrewLoc).click();
driver.findElement(toShoppingBtnLoc).click();
}
/**
* enterLoginPage: enter to login page
*/
public void enterLoginPage(){
driver.findElement(myAccountLoc).click();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
}
/**
* enterHomePage: enter to home page
*/
public void enterHomePage(){
WebElement homeCategoryElement = driver.findElement(homeCategoryLoc);
doubleClickAction.doubleClick(homeCategoryElement).build().perform();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
}
/**
* returnToHomePage: return to home page
*/
public void returnToHomePage(){
enterHomePage();
}
}