83 lines
2.2 KiB
Java
83 lines
2.2 KiB
Java
package page;
|
|
|
|
import org.openqa.selenium.*;
|
|
import org.openqa.selenium.interactions.Actions;
|
|
import org.openqa.selenium.support.FindBy;
|
|
|
|
import java.util.List;
|
|
import org.openqa.selenium.support.FindBy;
|
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
|
|
public class ReviewsPage {
|
|
private WebDriver driver;
|
|
private WebDriverWait wait;
|
|
|
|
@FindBy(xpath = "//*[@id=\"NewQuestion\"]")
|
|
private WebElement inputTextField;
|
|
|
|
@FindBy(xpath = "//*[@id=\"AddQuestionButton\"]")
|
|
private WebElement submitButton;
|
|
|
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[2]/div/input")
|
|
private WebElement rewiewsButton;
|
|
|
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[5]/div/div[1]/div[4]/div[1]/span[1]")
|
|
private WebElement yesButton;
|
|
|
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[5]/div/div[1]/div[4]/div[2]")
|
|
private WebElement text;
|
|
|
|
@FindBy(xpath = "//*[@id=\"star_error\"]")
|
|
private WebElement error;
|
|
|
|
@FindBy(xpath = "//*[@id=\"Text\"]")
|
|
private WebElement rewiewTextArea;
|
|
|
|
@FindBy(xpath = "//*[@id=\"ComplaintAttributes_0__isChecked\"]")
|
|
private WebElement rewiewCheck;
|
|
|
|
@FindBy(xpath = "//*[@id=\"miss\"]")
|
|
private WebElement rewiewSubmitButton;
|
|
|
|
public ReviewsPage(WebDriver driver) {
|
|
this.driver = driver;
|
|
wait = new WebDriverWait(driver,30,500);
|
|
}
|
|
public void setText(String str) {
|
|
inputTextField.sendKeys(str);
|
|
}
|
|
|
|
public void submitButtonClick(){
|
|
submitButton.click();
|
|
}
|
|
|
|
public void rewiewClick(){
|
|
rewiewsButton.click();
|
|
}
|
|
|
|
public void likeRewiewClick(){
|
|
yesButton.click();
|
|
}
|
|
|
|
public String getText(){
|
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"MainContent\"]/div[5]/div/div[1]/div[4]/div[2]")));
|
|
return text.getText();
|
|
}
|
|
|
|
public void setRewiewText(String str) {
|
|
rewiewTextArea.sendKeys(str);
|
|
}
|
|
|
|
public void rewiewCheckClick(){
|
|
rewiewCheck.click();
|
|
}
|
|
|
|
public void rewiewSubmitClick(){
|
|
rewiewSubmitButton.click();
|
|
}
|
|
|
|
public boolean isErrorPresent() {
|
|
return error.isDisplayed();
|
|
}
|
|
} |