Update AnotherLinks.java

This commit is contained in:
Екатерина 2018-12-08 20:41:23 +00:00
parent 653dc6fd71
commit 065d590693

View File

@ -1,20 +1,19 @@
package ru.oriflame.pages; package ru.oriflame.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class AnotherLinks { public class AnotherLinks {
public WebDriver driver; public WebDriver driver;
public AnotherLinks(WebDriver driver) { public AnotherLinks(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver; this.driver = driver;
} }
@FindBy(className = "shipping-info-link") @FindBy(className = "shipping-info-link")
private WebElement delivery; private WebElement form;
@FindBy(linkText = "Контакты Сервисных Центров Орифлэйм") @FindBy(linkText = "Контакты Сервисных Центров Орифлэйм")
private WebElement contactsServicesCenters; private WebElement contactsServicesCenters;
@ -22,15 +21,31 @@ public class AnotherLinks {
@FindBy(css = "nav.w-grid > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)") @FindBy(css = "nav.w-grid > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)")
private WebElement oriLogo; private WebElement oriLogo;
public void deliveryClicking () { public void formClicking () { form.click(); }
delivery.click();
}
public void clickingContactsServicesCenters() { public void clickingContactsServicesCenters() {
contactsServicesCenters.click(); contactsServicesCenters.click();
} }
public void clickingOrifalemLogo() { public void clickingOrifalemLogo() { oriLogo.click(); }
oriLogo.click();
public boolean assertMainMenu() { return driver.findElement(By.cssSelector("#main > div")).isDisplayed(); }
public boolean assertContactsServicesCenters() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return driver.findElement(By.cssSelector("body > div.w-grid")).isDisplayed();
}
public boolean assertFormClick() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return driver.findElement(By.cssSelector("#pdp-shipping-popup")).isDisplayed();
} }
} }