SHARE
TWEET

Untitled

a guest Oct 10th, 2019 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.openqa.selenium.By;
  2. import org.openqa.selenium.NoSuchElementException;
  3. import org.openqa.selenium.StaleElementReferenceException;
  4. import org.openqa.selenium.support.ui.ExpectedConditions;
  5. import org.openqa.selenium.support.ui.WebDriverWait;
  6. import org.testng.Assert;
  7. import org.testng.annotations.Test;
  8.  
  9. public class JiraLoginTest extends BaseClass {
  10.  
  11.     private By userName = By.xpath("//*[@id='login-form-username']");
  12.     private By password = By.xpath("//*[@id='login-form-password']");
  13.     private By loginButton = By.xpath("//*[@id='login']");
  14.     private By createButton = By.xpath("//*[@id='create_link']");
  15.  
  16.     @Test
  17.     public void jiraLoginPageTest() {
  18.         System.out.println("@Test1");
  19.         try {
  20.             driver.findElement(userName).sendKeys("webinar5");
  21.             driver.findElement(password).sendKeys("webinar5");
  22.             driver.findElement(loginButton).click();
  23.  
  24.         } catch (NoSuchElementException | StaleElementReferenceException exception) {
  25.             System.out.println("Web UI element wasn't found, or has been changed unexpectedly");
  26.         }
  27.  
  28.         WebDriverWait wait = new WebDriverWait(driver, 20);
  29.         wait.until(ExpectedConditions.elementToBeClickable(createButton));
  30.  
  31.         Assert.assertTrue(this.driver.findElement(createButton).isDisplayed());
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top