49 lines
1.4 KiB
Java
49 lines
1.4 KiB
Java
package grant;
|
|
|
|
import core.PageObject;
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.WebElement;
|
|
import org.openqa.selenium.support.ui.Select;
|
|
|
|
public class GrantPage extends PageObject {
|
|
@Override
|
|
public String getSubTitle() {
|
|
return driver.findElement(By.tagName("h2")).getText();
|
|
}
|
|
|
|
public String getId() {
|
|
return driver.findElement(By.id("id")).getAttribute("value");
|
|
}
|
|
|
|
public void setTitle(String name) {
|
|
driver.findElement(By.id("title")).clear();
|
|
driver.findElement(By.id("title")).sendKeys(name);
|
|
}
|
|
|
|
public String getTitle() {
|
|
return driver.findElement(By.id("title")).getAttribute("value");
|
|
}
|
|
|
|
public void setDeadline(String date, Integer i, String description) {
|
|
driver.findElement(By.id(String.format("deadlines%d.date", i))).sendKeys(date);
|
|
driver.findElement(By.id(String.format("deadlines%d.description", i))).sendKeys(description);
|
|
}
|
|
|
|
public void setLeader() {
|
|
WebElement webElement = driver.findElement(By.id("leaderId"));
|
|
Select selectLeader = new Select(webElement);
|
|
selectLeader.selectByVisibleText("Романов");
|
|
}
|
|
|
|
public void saveGrant() {
|
|
driver.findElement(By.id("sendMessageButton")).click();
|
|
}
|
|
|
|
public boolean checkBlankFields() {
|
|
if (driver.findElements(By.className("alert-danger")).size() > 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|