From 8ab0bf1374e204ec5a238e8d09e6e0eaf1934f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BA=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=BD=D0=B0?= Date: Sat, 8 Dec 2018 20:54:00 +0000 Subject: [PATCH] Update ChangeLanguages.java --- .../ru/oriflame/pages/ChangeLanguages.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java index a6a2960..5e53518 100644 --- a/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java @@ -1,20 +1,19 @@ package ru.oriflame.pages; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; public class ChangeLanguages { public WebDriver driver; public ChangeLanguages(WebDriver driver) { - PageFactory.initElements(driver, this); this.driver = driver; } - @FindBy(xpath = "//*[@id=\"accordion-2\"]") + @FindBy(xpath = "//*[@id=\"accordion-2\"]") private WebElement asiaButton; @FindBy(xpath = "//*[@id=\"sect2\"]/ul[1]/li[1]/a/span") @@ -27,4 +26,20 @@ public class ChangeLanguages { public void chinaLinking() { chinaLink.click(); } + + public boolean assertChangelanguag() { + try { + Thread.sleep(15000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + try { + return driver.findElement(By.cssSelector("body > header > div > div.ui-sticky-bar.js-sticky-bar > div.w-sticky-bar-list.clearfix > ul > li.catalogue.left.only-for-desktop-size > a")).getText().indexOf("产品目录") >= 0; + } + catch (Exception e) + { + return false; + } + } }