Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By;
- import org.openqa.selenium.NoSuchElementException;
- import org.openqa.selenium.StaleElementReferenceException;
- import org.openqa.selenium.support.ui.ExpectedConditions;
- import org.openqa.selenium.support.ui.WebDriverWait;
- import org.testng.Assert;
- import org.testng.annotations.Test;
- public class JiraLoginTest extends BaseClass {
- private By userName = By.xpath("//*[@id='login-form-username']");
- private By password = By.xpath("//*[@id='login-form-password']");
- private By loginButton = By.xpath("//*[@id='login']");
- private By createButton = By.xpath("//*[@id='create_link']");
- @Test
- public void jiraLoginPageTest() {
- System.out.println("@Test1");
- try {
- driver.findElement(userName).sendKeys("webinar5");
- driver.findElement(password).sendKeys("webinar5");
- driver.findElement(loginButton).click();
- } catch (NoSuchElementException | StaleElementReferenceException exception) {
- System.out.println("Web UI element wasn't found, or has been changed unexpectedly");
- }
- WebDriverWait wait = new WebDriverWait(driver, 20);
- wait.until(ExpectedConditions.elementToBeClickable(createButton));
- Assert.assertTrue(this.driver.findElement(createButton).isDisplayed());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement