91 lines
3.4 KiB
Java
91 lines
3.4 KiB
Java
package page;
|
|
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.WebDriver;
|
|
import org.openqa.selenium.WebElement;
|
|
import org.openqa.selenium.support.FindBy;
|
|
import java.io.File;
|
|
|
|
public class SubMenuPage {
|
|
WebDriver driver;
|
|
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[1]/div/div/div/div[3]/div[1]/a")
|
|
private WebElement plusElement;
|
|
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[1]/ul/li[2]/a/span")
|
|
private WebElement hyperlinkElement;
|
|
@FindBy(xpath = "//*[@id=\"header\"]/div[2]/div/div/div[1]/div/a")
|
|
private WebElement logotypeElement;
|
|
@FindBy(xpath = "//*[@id=\"main\"]/div/div[2]/div[1]/ol/li[2]/a")
|
|
private WebElement breadcrumbsElement;
|
|
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[2]/ul/li[2]/a/span")
|
|
private WebElement sidebarElementExternalLinks;
|
|
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[3]/ul/li[2]/a/span")
|
|
private WebElement myFavoritesElement;
|
|
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[1]")
|
|
private WebElement addDocumentToFavoritesElement;
|
|
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[3]")
|
|
private WebElement openDocumentElement;
|
|
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[2]")
|
|
private WebElement downloandDocumentElement;
|
|
public boolean isMessageDisplay() {
|
|
return driver.findElement(By.xpath("//*[@id=\"home\"]/div[8]/div/div/div/div/div/div[1]")).isDisplayed();
|
|
}
|
|
public void clickBreadcrumbsElement() {
|
|
breadcrumbsElement.click();
|
|
}
|
|
public void clickSidebarExternalElement() {
|
|
sidebarElementExternalLinks.click();
|
|
}
|
|
public void clickMyFavoritesElement() {
|
|
myFavoritesElement.click();
|
|
}
|
|
public void clickAddDocumentToFavoritesElement() {
|
|
addDocumentToFavoritesElement.click();
|
|
}
|
|
public void clickOpenDocumentElement() {
|
|
openDocumentElement.click();
|
|
}
|
|
public void clickDownloandDocumentElement() {
|
|
downloandDocumentElement.click();
|
|
}
|
|
public void clickPlus() {
|
|
plusElement.click();
|
|
}
|
|
public void clickHyperlink() {
|
|
hyperlinkElement.click();
|
|
}
|
|
public void clickLogoElement() {
|
|
logotypeElement.click();
|
|
}
|
|
public SubMenuPage(WebDriver driver) {
|
|
this.driver = driver;
|
|
}
|
|
public boolean isPageDisplaySubmenu() {
|
|
return driver.findElement(By.className("panel-heading")).isDisplayed();
|
|
}
|
|
public boolean isPageDisplayPlus() {
|
|
return driver.findElement(By.cssSelector(".collapse.in")).isDisplayed();
|
|
}
|
|
public boolean isPageDisplayMinus() {
|
|
return driver.findElement(By.cssSelector("div[aria-expanded='false']")).isDisplayed();
|
|
}
|
|
public boolean isPageDisplayDocuments() {
|
|
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"Внутренние документы\"]")).isDisplayed();
|
|
}
|
|
public String getFileName() {
|
|
String fileName = openDocumentElement.getAttribute("href");
|
|
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
|
return fileName;
|
|
}
|
|
|
|
public boolean checkOpen(String str) {
|
|
boolean check = false;
|
|
File f = new File(str);
|
|
String s = driver.getCurrentUrl();
|
|
if (s.contains(str))
|
|
check = true;
|
|
return check;
|
|
}
|
|
|
|
|
|
|
|
} |