@AfterClass
 public void tearDownClass() throws Exception {
   // Logout from application
   if ($(By.xpath(".//*[@id='toolBarForm:imgUserLogout']")).exists()) {
     $(By.xpath(".//*[@id='toolBarForm:imgUserLogout']")).waitUntil(enabled, 10000).click();
   }
 }
public enum GroupEdit implements Element {
  EDIT_GROUP(By.id("action-button-edit-0")),
  MEMBERSHIP_GROUP(By.id("action-button-member-0")),
  EXTERNAL_ID_GROUP(By.id("externalId")),
  ADD_USER_GROUP(By.id("move-to-member")),
  REMOVE_USER_GROUP(By.id("remove-from-member")),

  // adavies
  EXTERN_USER(
      By.xpath(
          "//select[contains(@id, 'outsider')]/..//option[contains(@value, '03dc8f50-acaa-44d6-9401-bdfc5e10e821')]")),
  GROUP_USER(
      By.xpath(
          "//select[contains(@id, 'member')]/..//option[contains(@value, '03dc8f50-acaa-44d6-9401-bdfc5e10e821')]"));

  private By by;

  private GroupEdit(By by) {
    this.by = by;
  }

  @Override
  public By by() {
    return this.by;
  }
}
Exemplo n.º 3
0
/** @author ligyu */
public class PublishingListUI extends AdminConsoleUI {

  public static By SEARCH_INPUT = By.id("txt_search_name");
  public static By SEARCHGO_BUTTON = By.xpath("//input[@type='submit' and @value='Go']");

  public static By ADD_LINK = By.xpath("//a[.='Add Publishing List']");

  public static By GetDeleteLinkByName(String name) {
    return By.xpath("//td[contains(text(), '" + name + "')]/../td[2]/ul/li[3]/a");
  }

  public static By GetEditLinkByName(String name) {
    return By.xpath("//td[contains(text(), '" + name + "')]/../td[2]/ul/li[2]/a");
  }

  public static By GetDuplicateLinkByName(String name) {
    return By.xpath("//td[contains(text(), '" + name + "')]/../td[2]/ul/li[1]/a");
  }

  public static By MESSAGE_TEXT = By.xpath("//div[@id='validation_summary']/ul[1]/li");

  // Add Publishing List Page
  public static By NAME_INPUT = By.name("delivery_list_name");
  public static By EDITEMAIL_LINK = By.id("new0_lnk");
  public static By EMAIL_TEXTAREA = By.id("new0_txa");
  public static By EDITEMAIL1_LINK = By.id("new1_lnk");
  public static By EMAIL1_TEXTAREA = By.id("new1_txa");
  public static By SAVE_BUTTON = By.xpath("//input[@type='submit' and @value='Save']");
  public static By ERROR_TEXT = By.id("new0_error");
}
Exemplo n.º 4
0
  @Test
  public void shouldShowCorrectAnswerPopupWhenAnswerIsCorrect() {
    driver.get(URL);
    String title = driver.getTitle();
    assertEquals("Rule Financial Registration Form", title);

    this.fillRegistrationFields();
    driver.findElement(By.xpath("//*[@class='gwt-Button' and text()='Java']")).click();
    if (this.chooseTypeOfAnswerForQuestion(true)) {
      driver.findElement(By.xpath("//*[@id='gwt-uid-26']")).click(); // checkBox on the site
      // Save button             | //*[text()='Save']
      driver
          .findElement(By.xpath("html/body/div[2]/div[2]/div/div/div/table/tbody/tr/td[1]/button"))
          .click();

      String alertText =
          driver
              .findElement(By.xpath("html/body/div[5]/div/div/table/tbody/tr[1]/td/div"))
              .getText();
      // close an alert
      driver.findElement(By.xpath("//button[text()='Close']")).click();
      assertEquals("Congratulations! You've won:", alertText);
    } else {
      System.out.println("Błąd z zaznaczeniem check box, lub przyciskiem Save");
    }
  }
Exemplo n.º 5
0
 private void Location() throws IOException {
   // Click Location
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Location\")]"))
       .click();
   // Click West Checkbox
   // TODO Do not use number in Locator
   driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[3]/input")).click();
   // Click South Checkbox
   // TODO Do not use number in Locator
   driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[6]/input")).click();
   // Click Apply
   driver.findElement(By.id("edit-location-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
Exemplo n.º 6
0
  private void accept(WebDriver driver, String message) {
    StopWatch stopWatch = new Log4JStopWatch();
    stopWatch.start();

    WebElement img = driver.findElement(By.xpath("//img[@alt='Click to sign']"));
    driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
    img.click();

    List<WebElement> signed_imgs = driver.findElements(By.xpath("//img[@alt='Signed']"));
    driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);

    if (signed_imgs.size() != 0) {
      stopWatch.stop("accept", message);
    } else {
      randomDelay();
      stopWatch.start();
      WebElement awsForm = driver.findElement(By.name("awsForm"));

      driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
      awsForm.submit();

      signed_imgs = driver.findElements(By.xpath("//img[@alt='Signed']"));
      driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
      stopWatch.stop("accept'", message);
    }
  }
 /**
  * Test all SCOes
  *
  * @param mode
  * @param course
  * @param scoLeft
  */
 public void testSCO(char mode, int course, int scoLeft) {
   wait.until(presenceOfElementLocated(By.id("n")));
   String url = driver.getCurrentUrl();
   if (mode == 'b') {
     driver.findElement(By.id("b")).click();
   } else {
     driver.findElement(By.id("n")).click();
   }
   driver.findElement(By.xpath("//input[@value='Enter']")).click();
   wait.until(presenceOfElementLocated(By.id("ygtvcontentel2")));
   wait.until(presenceOfElementLocated(By.id("scorm_object")));
   System.out.println("SCO Loaded. Testing ...");
   driver.switchTo().frame("scorm_object");
   if ((course == 1 && currentSCO != 4) || (course == 2 && currentSCO != 2)) {
     wait.until(
         presenceOfElementLocated(
             By.xpath("//*[contains(.,'Status:  This SCO Test Completed.')]")));
   } else if ((course == 1 && currentSCO == 4) || (course == 2 && currentSCO == 2)) {
     // for both course 1 and course 2
     if (scoLeft != 0) {
       wait.until(
           presenceOfElementLocated(
               By.xpath("//*[contains(.,'Please Log out and re-login to the LMS.')]")));
       return;
     } else {
       wait.until(
           presenceOfElementLocated(
               By.xpath("//*[contains(.,'Status:  This SCO Test Completed.')]")));
     }
   }
   System.out.println(driver.findElement(By.id("teststatus")).getText());
   currentSCO++;
   driver.get(url);
 }
 @Override
 public void gotoNewApplicationsPage() {
   driver.findElement(By.xpath("//a[contains(text(),'My applications')]")).click();
   pages.myApplicationsPage.ensurePageLoaded();
   driver.findElement(By.xpath("//a[contains(text(),'Click to add new application')]")).click();
   pages.newApplicationPage.ensurePageLoaded();
 }
  public String checkLinkedResource(String project2) throws InterruptedException {

    List<WebElement> resources =
        driverWait.until(
            ExpectedConditions.visibilityOfAllElementsLocatedBy(
                By.xpath(".//*[@class='resources']/li")));

    for (int i = 1; i <= resources.size(); i++) {
      WebElement lblLink =
          driverWait.until(
              ExpectedConditions.visibilityOfElementLocated(
                  By.xpath(".//*[@class='resources']/li[" + i + "]/div[2]/a")));

      if (lblLink.getText().equals(project2)) {
        lblLink.click();
        TimeUnit.SECONDS.sleep(2);
        WebElement title =
            driverWait.until(
                ExpectedConditions.visibilityOfElementLocated(
                    By.xpath(".//*[@id='projects_project_title_input']/span")));

        return title.getText();
      }
    }
    return "";
  }
Exemplo n.º 10
0
  @Ignore
  @Test
  public void TestCase_00X() throws Exception {
    LogGenerator.addLog(Level.INFO, "Starting Test Case_00X");
    driver.get("http://myitlabgrader.com/HTML5/SIMFrame.html");
    synchronized (driver) {
      driver.wait(6000);
    }

    driver.findElement(By.id("viewallbutton")).click();
    driver.findElement(By.xpath("//div[@id='ViewAllDlg']/div/table/tbody/tr[5]/td[2]")).click();
    driver.findElement(By.xpath("(//button[@type='button'])[2]")).click();
    driver
        .findElement(By.xpath("//div[@class='excelWorkBook']/div/div/div[2]/ul[3]/li[2]/div"))
        .click();

    ((JavascriptExecutor) driver)
        .executeScript("$('div#12_selectionBorder1.selectionBorderDiv').dblclick();");
    //
    // ((JavascriptExecutor)driver).executeScript("$('div#12_selectionBorder1.selectionBorderDiv').focus();")  ;

    driver.findElement(By.xpath("//*[@id='12_editableDiv1']/div")).sendKeys("Semester 1");
    //
    //	driver.findElement(By.xpath("//div[@class='excelWorkBook']/div/div/div[2]/ul[3]/li[4]/div")).click();

    driver.findElement(By.xpath("//*[@id='12_editableDiv1']/div")).sendKeys(Keys.RETURN);

    //					 ((JavascriptExecutor)driver).executeScript("$('div#12_editableDiv1').keypress(function
    // (e){if(e.keyCode == 13) });")  ;
    synchronized (driver) {
      driver.wait(6000);
    }
    String name = (new Exception().getStackTrace()[0].getMethodName());
    CaptureScreenshot.takeScreenshot(driver, name);
  }
 @Test
 public void SearchStation() throws InterruptedException {
   // driver.switchTo().defaultContent();
   // input on username
   driver.findElement(By.xpath("//*[@ng-keydown='onSearchKeyDown($event)']")).sendKeys("Z100");
   // Print out first three rows of result
   System.out.println(
       driver
           .findElement(By.xpath("//*[@class='table table-striped search']/tbody/tr[1]"))
           .getText());
   System.out.println(
       driver
           .findElement(By.xpath("//*[@class='table table-striped search']/tbody/tr[2]"))
           .getText());
   System.out.println(
       driver
           .findElement(By.xpath("//*[@class='table table-striped search']/tbody/tr[3]"))
           .getText());
   /*
   HomePage.SelectMarkets_Stream_Filter("Portland, OR");
   HomePage.FirstRowResult();
   Thread.sleep(2000);
   driver.findElement(By.xpath("//*[@ng-click='clearSearch()']")).click();  //clear search
   HomePage.SelectMarkets_Stream_Filter("Markets");
    Thread.sleep(5000);
    */
 }
 @Test
 public void testReserveringBevestigen() throws Exception {
   driver.get(baseUrl + "/Themaopdracht/loginpage.jsp");
   driver.findElement(By.name("username")).clear();
   driver.findElement(By.name("username")).sendKeys("Henk");
   driver.findElement(By.name("password")).clear();
   driver.findElement(By.name("password")).sendKeys("hww");
   driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
   driver.get("http://*****:*****@name='knop'])[2]")).click();
   driver.findElement(By.cssSelector("#content > form > p > input[name=\"knop\"]")).click();
   assertEquals(
       "De reservering is succesvol bevestigd",
       driver.findElement(By.cssSelector("h3.msg > span")).getText());
   driver.findElement(By.xpath("(//input[@name='knop'])[2]")).click();
   assertTrue(isElementPresent(By.cssSelector("h3.error")));
   driver.findElement(By.name("zoekviaID")).clear();
   driver.findElement(By.name("zoekviaID")).sendKeys("abc");
   driver.findElement(By.xpath("(//input[@name='knop'])[2]")).click();
   assertTrue(isElementPresent(By.cssSelector("h3.error")));
   driver.findElement(By.name("zoekviaID")).clear();
   driver.findElement(By.name("zoekviaID")).sendKeys("1");
   driver.findElement(By.xpath("(//input[@name='knop'])[2]")).click();
   assertTrue(isElementPresent(By.cssSelector("h3.error")));
 }
Exemplo n.º 13
0
  protected void waitForFolderToLoad(final String folderName) throws Exception {
    logMsg("Waiting for folder: " + folderName);
    int count = 0;
    try {
      getJspTestUtils().waitSec();
      String crumb =
          getJspTestUtils()
              .findElement(By.id("auto_folder_search_dialog_breadcrumbs"))
              .findElement(By.xpath("//strong"))
              .getText();
      while (count < 12 && !crumb.toLowerCase().contains(folderName.toLowerCase())) {

        logMsg("    Found: " + crumb);
        if (getJspTestUtils().isElement(By.id(folderName))) {
          logMsg("Clicking " + folderName);
          getJspTestUtils().findElement(By.id(folderName)).click();
        }
        count++;
        getJspTestUtils().waitSec();
        crumb =
            getJspTestUtils()
                .findElement(By.id("auto_folder_search_dialog_breadcrumbs"))
                .findElement(By.xpath("//strong"))
                .getText();
      }
    } catch (ErrorHandler.UnknownServerException e) {
      logMsg("Threw UnknownServerException");
    }
  }
  @Test
  @Title("Add permission to the role, verify that permissions work")
  public void test001UserRightsVerification() throws InterruptedException {

    OpenView.openExtras(UserAdministration);

    // Click Roles button
    $("#rolesEnabled").waitUntil(enabled, 8000).click();

    // Link the created role to the user
    String role = "//*[contains(text(), '" + rolename + "')]/../../../..//input";
    $(By.xpath(role)).waitUntil(present, 8000).setSelected(true);

    // Deselect Adminrolle
    String Adminrolle = "//*[contains(text(), 'Adminrolle')]/../../../..//input";
    $(By.xpath(Adminrolle)).setSelected(false);

    // Click Save button
    $(By.xpath(".//*[@id='role_panel_mpBForm:save_link']")).waitUntil(enabled, 8000).click();
    $("#role_panelHeader").waitUntil(disappear, 10000);

    // Asserts
    $$(By.xpath(".//*[@id='RoleDataList:j_id686']//*[@class='toggle_item_label']"))
        .shouldHave(sizeGreaterThanOrEqual(1))
        .shouldHave(texts(rolename));

    // Logout
    $(By.xpath(".//*[@id='toolBarForm:imgUserLogout']")).waitUntil(enabled, 6000).click();
  }
Exemplo n.º 15
0
  @Test(timeOut = 20000)
  public void SearchingResultPosts() {
    // Validating Search No Results
    HomePage homePage = PageFactory.initElements(driver, HomePage.class);
    homePage.go(driver);
    homePage.search("not found");
    Assert.assertTrue(
        driver.findElement(By.xpath("//article[@id='post-0']/header/h1")).isDisplayed(),
        "Nothing Found");
    Assert.assertEquals("not found | Search Results | Automation Training", driver.getTitle());

    // Validating post results with the word "test"
    homePage.go(driver);
    homePage.waitForTitle();
    homePage.search("test");

    WebDriverWait waitForOne = new WebDriverWait(driver, 10);
    waitForOne.until(
        ExpectedConditions.presenceOfElementLocated(By.xpath("//h1[@id='site-title']/span/a")));
    waitForOne.until(
        ExpectedConditions.presenceOfElementLocated(
            By.xpath("//article[@id='post-39']/header/h1/a")));
    waitForOne.until(
        ExpectedConditions.presenceOfElementLocated(By.linkText("What software testing is")));

    driver.findElement(By.className("page-title")).isDisplayed();

    Assert.assertTrue(
        driver.findElement(By.xpath("//header/h1/span")).isDisplayed(), "SEARCH RESULTS FOR: TEST");

    waitForOne.until(ExpectedConditions.titleContains("test"));

    assert (driver.getTitle().contains(("test | Search Results | Automation Training")));
  }
  protected String addTextToDesc(String toolBarXPath, String descToTest)
      throws InterruptedException {

    WebElement descriptionToolBar = getWebDriver().findElement(By.xpath(toolBarXPath));

    TimeUnit.SECONDS.sleep(2);

    WebElement textLoader = descriptionToolBar.findElement(By.cssSelector(".text.load"));
    textLoader.click();

    writeInRedactor(descToTest);

    WebElement saveDescription =
        driverWait.until(
            ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@title='Save']")));
    saveDescription.click();

    WebElement text =
        driverWait.until(
            ExpectedConditions.visibilityOfElementLocated(
                By.xpath(".//*[starts-with(@id,'form_for_textarea_')]/span")));
    String description = text.getText();

    return description;
  }
Exemplo n.º 17
0
  /**
   * Paste the current content in the clipboard into a specific target, will wait for ajax refresh
   *
   * @param target the target's label to paste in
   * @return this agent
   * @throws Exception
   */
  public ClipboardAgent pasteContent(String target, boolean isAjaxList) throws Exception {

    String pasteSelectorPrefix = "//h2[contains(text(),'" + target + "')]";
    String pasteSelectorSuffix =
        "/button[contains(@class, 'clipboard') and contains(@title, 'Paste')]";

    // Slots
    String pasteSelector = pasteSelectorPrefix + "/../" + pasteSelectorSuffix;

    WebDriver webDriver = guiAgent.getWebDriver();

    if (webDriver.findElements(By.xpath(pasteSelector)).isEmpty()) {
      // Content lists
      pasteSelector = pasteSelectorPrefix + pasteSelectorSuffix;
    }

    if (webDriver.findElements(By.xpath(pasteSelector)).isEmpty()) {
      pasteSelector = "//fieldset[contains(@class, '" + target + "']/" + pasteSelectorSuffix;
    }

    webDriver.findElement(By.xpath(pasteSelector)).click();

    if (isAjaxList) {
      guiAgent.agentWait().waitForAjaxPageToLoad();
    } else {
      guiAgent.agentWait().waitForPageToLoad();
    }

    return this;
  }
  @Test
  public void test() throws InterruptedException {
    // Alert popup Handling.
    driver.findElement(By.xpath("input[@value='Show Me Alert']")).click();
    // To locate alert
    Alert A1 = driver.switchTo().alert();
    // To read the text from alert popup.
    String Alert1 = A1.getText();
    System.out.println(Alert1);
    Thread.sleep(2000);
    // To accept/Click OK on the alert popup
    A1.accept();

    // Confirmation Pop up handling.
    driver.findElement(By.xpath("//button[@onlick='myFunction()']")).click();
    Alert A2 = driver.switchTo().alert();
    String Alert2 = A2.getText();
    System.out.println(Alert2);
    Thread.sleep(2000);
    // To Click on cancel button of confirmation box.
    A2.dismiss();

    // Prompt pop up handling.
    driver.findElement(By.xpath("//button[contains(.,'Show Me Prompt')]")).click();
    Alert A3 = driver.switchTo().alert();
    String Alert3 = A3.getText();
    System.out.println(Alert3);
    // To type text Im text box of prompt pop up.
    A3.sendKeys("This is John");
    Thread.sleep(2000);
    A3.accept();
  }
Exemplo n.º 19
0
  @Test
  public void testGotoFinalReview() throws Exception {

    // Goto Final Review page
    driver.findElement(By.xpath("//a[contains(text(), 'Final Review')]")).click();
    try {
      assertEquals(
          "Final Review", driver.findElement(By.xpath("//*[@id='container']/h3")).getText());
    } catch (Error e) {
      screenShots.takeScreenShot("gotoFinalReview");
      verificationErrors.append(e.toString());
    }

    Thread.sleep(300);
    // Find where the warning is displayed and scroll it into view, then screenshot it.
    // We look for 'Scholarship and Sponsorship' since the warning is in the 'Qualifications' area
    // and the scrolling is causing a heading right where we scroll to and covers it.
    WebElement elem =
        driver.findElement(By.xpath("//h4[contains(text(), 'Scholarship and Sponsorship')]"));
    ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", elem);
    Thread.sleep(300);
    screenShots.takeScreenShot("FinalReviewWarnMsgNoQualifEntrd");

    // Go back to application
    driver.findElement(By.cssSelector("#link_to_application > span")).click();
  }
Exemplo n.º 20
0
public class DevBySalaryPage extends BaseForm {
  private static String formlocator = "//body/div[@class='wrapper dev all']";

  private Button devByPositionLink = new Button(By.linkText("Должности"), "link on positions");
  private Button devByPositionQALink =
      new Button(By.partialLinkText("QA Engineer"), "link on QA position");
  private Label devBySalaryRations =
      new Label(
          By.xpath("//strong[contains(., 'Соотношение размеров зарплат')]"), "salary rations text");
  private Label devBySalaryForQA =
      new Label(
          By.xpath("//span[@class='ui-selectmenu-status' and contains(., 'QA Engineer/ Tester')]"),
          "salary for QA in menu");

  public void clickOnPositionAll() {
    devByPositionLink.click();
  }

  public void clickOnPositionQA() {
    devByPositionQALink.click();
  }

  public DevBySalaryPage() {
    super(By.xpath(formlocator), "dev.by Salary page");
  }

  public void assertDevBySalary() {
    assert (devBySalaryRations.isPresent(10) && devBySalaryForQA.isPresent(10));
  }
}
Exemplo n.º 21
0
  @Test
  public void shouldShowWrongAnswerPopupWhenAsnwerIsIncorrect() {
    driver.get(URL);
    String title = driver.getTitle();
    assertEquals("Rule Financial Registration Form", title);
    /*
     * Your code needs to be here, sample below should help you a bit
     * driver.findElement(By.name("firstName")).clear();
     * driver.findElement(By.name("firstName")).sendKeys("Marek");
     */
    this.fillRegistrationFields();
    driver.findElement(By.xpath("//*[@class='gwt-Button' and text()='Java']")).click();
    if (this.chooseTypeOfAnswerForQuestion(false)) {
      driver.findElement(By.xpath("//*[@id='gwt-uid-26']")).click(); // checkBox on the site
      // Save button             | //*[text()='Save']
      driver
          .findElement(By.xpath("html/body/div[2]/div[2]/div/div/div/table/tbody/tr/td[1]/button"))
          .click();

      String alertText =
          driver
              .findElement(By.xpath("html/body/div[5]/div/div/table/tbody/tr[1]/td/div"))
              .getText();
      // close an alert
      driver.findElement(By.xpath("//button[text()='Close']")).click();
      assertEquals("We're sorry but your answer was incorrect.", alertText);
    } else {
      System.out.println("Błąd z zaznaczeniem check box, lub przyciskiem Save");
    }
  }
 public void cancelGameCenterLogin() throws Exception {
   log("Check to see if Google Plus Sign in needs to be cancelled..");
   if (driver.getPageSource().contains("Choose an account")) {
     if (automationName.equalsIgnoreCase("selendroid")) {
       driver.findElement(By.xpath("//LinearLayout/Button[@text='Cancel']")).click();
     } else if (platformName.equalsIgnoreCase("android")) {
       driver.findElement(By.xpath("//android.widget.Button[@text='Cancel']")).click();
     } else { // we are on ios
       driver.findElementByAccessibilityId("Cancel").click();
     }
   }
   if (automationName.equalsIgnoreCase("selendroid")) {
     while (findImageOnScreenNoAssert("native_sign_in_button") != null) {
       tapImageOnScreen("native_sign_in_button", 0.75, 0.5, 1);
     }
   } else {
     if (driver.getPageSource().contains("SIGN IN")
         || (driver.getPageSource().contains("Sign in"))
         || (driver.getPageSource().contains("Sign In"))) {
       log("Google Plus sign in shown...");
       takeScreenshot("google_plus_sign_in_shown");
       driver.findElement(By.xpath("//android.widget.Button[@text='Cancel']")).click();
       takeScreenshot("after_cancel_sign_in");
       driver.findElement(By.xpath("//android.widget.Button[@text='Cancel']")).click();
       takeScreenshot("after_second_cancel_sign_in");
     }
   }
 }
Exemplo n.º 23
0
 private void ActivitiesOfInterest() throws IOException {
   // Click Activities of Interest
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Activities of Interest\")]"))
       .click();
   // Click Student Newspaper Checkbox
   // TODO Do not use number in locator
   driver.findElement(By.xpath("//div[11]/input")).click();
   // Click TV Station Checkbox
   // TODO Do not use number in locator
   driver.findElement(By.xpath("//div[13]/input")).click();
   // Click Apply
   driver.findElement(By.id("edit-activities-interests-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
Exemplo n.º 24
0
  // odi.614 Able to generate reports for time range
  public void search() {
    String dmName = "US_AIRWAYS";
    gotoreports(dmName);
    try {
      driver.findElement(By.id("PARAM_START_DATE")).clear();
      Alert alert = driver.switchTo().alert();
      alert.dismiss();
      driver.findElement(By.id("PARAM_START_DATE")).sendKeys("8/11/2013");
      driver.findElement(By.id("PARAM_END_DATE")).clear();
      alert.dismiss();
      driver.findElement(By.id("PARAM_END_DATE")).sendKeys("9/11/2013");
      driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
      driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
      new WebDriverWait(driver, 10)
          .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("reportContent"));
      WebElement page =
          new WebDriverWait(driver, 10)
              .until(ExpectedConditions.visibilityOfElementLocated(By.id("CrystalViewer")));
      WebElement rangeStart = page.findElement(By.xpath("//*[contains(text(),'8/11/2013')]"));
      WebElement rangeEnd = page.findElement(By.xpath("//*[contains(text(),'9/11/2013')]"));
      if (rangeStart != null && rangeEnd != null) {
        System.out.println("Report for selected range is showed");
      }
      ReportFile = new WriteXmlFile();
      driver.switchTo().defaultContent();
      ReportFile.addTestCase("ODI6.x-614:CSSR-Search", "ODI6.x-614:CSSR-Search => Pass");

    } catch (Exception e) {
      System.out.print("trace: ");
      e.printStackTrace();
    }
    // driver.quit();
    ReportFile.WriteToFile();
  }
Exemplo n.º 25
0
 private void AreaOfStudy() throws IOException, InterruptedException {
   // Click Area of School
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Area of Study\")]"))
       .click();
   // Select One Area Study
   new Select(driver.findElement(By.id("edit-area-of-study-parent")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies");
   // Wait For Another Select List To Load
   Thread.sleep(5000);
   // Select Subareas of Study
   new Select(driver.findElement(By.xpath("//div[@id='child-area-of-study-wrapper']//select")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies, Other");
   // Click Apply
   driver.findElement(By.id("edit-area-of-study-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
Exemplo n.º 26
0
  /**
   * Can delete the goal if the user is the creator and the goal is not included in the appraisal
   *
   * @param driver
   */
  public void checkCanDelete(WebDriver driver) {
    String row_goal = "//tr[descendant::td/a[text()='" + this.getGoalTitle() + "']]";
    By by = By.xpath(row_goal + "/td[2]/div/div/button");
    // Navigator.explicitWait();
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    WebDriverUtils.mouseOver(driver, by);

    by = By.linkText("Delete");
    // Navigator.explicitWait();
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    int size = WebDriverUtils.getHowManyByPresntInPage(driver, by, true);
    JUnitAssert.assertTrue(size > 0, "Cannot delete" + this.getGoalTitle());

    WebDriverUtils.clickLink(driver, by);
    String delMsg = Labels.Msg_Delete_Dev_Goal.toString();
    if (this instanceof PerformanceGoal) {
      delMsg = Labels.Msg_Delete_Perf_Goal.toString();
    }
    by =
        By.xpath(
            "//div[descendant::div[@id='jMessage' and text()='"
                + delMsg
                + "']]/div/div/button[descendant::span[text()='OK']]");
    WebDriverUtils.clickButton(driver, by);
  }
Exemplo n.º 27
0
  // Sends the number of catapults to the GUI
  public static void setCatapult() {

    // loop through all the show unit lines
    // if the unit name is found then display it on the GUI
    for (int i = 1; i < 15; i++) {
      try {
        String catapultLabel =
            WebAutomation.driver
                .findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]"))
                .getText();
        if (substring(catapultLabel, 2, 10).equals("Catapult")
            || substring(catapultLabel, 3, 11).equals("Catapult")
            || substring(catapultLabel, 4, 12).equals("Catapult")
            || substring(catapultLabel, 5, 13).equals("Catapult")
            || substring(catapultLabel, 6, 14).equals("Catapult")
            || substring(catapultLabel, 7, 15).equals("Catapult")) {
          TroopsDetailPanel.setCatapultLabel(
              WebAutomation.driver
                  .findElement(
                      By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong"))
                  .getText());
          break;
        }
        // the troop was not found
        else {
          TroopsDetailPanel.setCatapultLabel("0");
        }
      } catch (NoSuchElementException e) {
      }
    }
  }
Exemplo n.º 28
0
  /**
   * Add goal progress tracks
   *
   * @param driver
   * @param objs: a set of GoalProgress
   */
  public void runAddTrack(WebDriver driver, ArrayList<TestObject> objs) {
    Navigator.navigate(
        driver, Navigator.xmlWebElmtMgr.getNavigationPathList("LearningCenter", "MyGoals"));

    By by = By.xpath("//a[descendant::span[text()='" + Labels.Link_My_Perf_Goal + "']]");
    if (this instanceof DevelopmentGoal) {
      by = By.xpath("//a[descendant::span[text()='" + Labels.Link_My_Dev_Goal + "']]");
    }
    // Navigator.explicitWait(1000);
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    WebDriverUtils.clickButton(driver, by);
    by = By.linkText(this.getGoalTitle());
    WebDriverUtils.clickLink(driver, by);

    by = By.id("open-progress-dialog");
    WebDriverUtils.clickLink(driver, by);

    for (TestObject obj : objs) {
      ((GoalProgress) obj).create(driver);
    }

    by = By.xpath("//span[text()='Save']");
    WebDriverUtils.clickButton(driver, by);
  }
Exemplo n.º 29
0
 @Test
 public void testEditProfile() throws Exception {
   driver.get(baseUrl + "/");
   driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click();
   driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click();
   driver.findElement(By.id("email")).click();
   driver.findElement(By.id("email")).clear();
   driver.findElement(By.id("email")).sendKeys("*****@*****.**");
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys("Eliandtyler1");
   driver.findElement(By.id("submit-button")).click();
   driver.findElement(By.id("submit-button")).click();
   driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click();
   driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click();
   driver.findElement(By.linkText("Edit Profile & Settings")).click();
   driver.findElement(By.linkText("Edit Profile & Settings")).click();
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
 }
Exemplo n.º 30
0
  @SuppressWarnings("deprecation")
  @Test
  public void booking() {

    // click to choose book services
    //			driver.findElement(By.xpath(".//*[@id='gt_sr']")).click();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    // Click to choose service
    driver.findElement(By.xpath(Bookingpage.Service)).click();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    // Click to choose staff
    driver.findElement(By.xpath(Bookingpage.Staff1)).click();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    // Click to choose date
    List<WebElement> date = driver.findElements(By.xpath(Bookingpage.TodayDate));

    String selectedDate = date.get(0).getText();
    driver.findElement(By.linkText(selectedDate)).click();

    // List the timeslots
    List<WebElement> availslots = driver.findElements(By.xpath(Bookingpage.Timeslot));
    int bookings = availslots.size();
    System.out.println(" Time slots size :: " + bookings);
    try {
      if (bookings > 0) {
        String[] slots1 = new String[bookings];
        int j = 0;
        // System.out.println(" available slots :: "+availslots);
        for (WebElement avail : availslots) {
          slots1[j] = avail.getText();
          System.out.println(slots1[j]);
          j++;

          for (String SelectedSlot : slots1) {

            System.out.println("Selected SLot :: " + SelectedSlot);
            driver.findElement(By.linkText(SelectedSlot)).click();

            driver.findElement(By.id("cust-IName")).sendKeys("Vimal Tester");

            // Click on continue
            driver.findElement(By.xpath(".//*[@id='cust-continue']")).click();
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            // Book My Appointment
            driver.findElement(By.className("global_btn2_rt")).click();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
          }

          break;
        }
      } else {
        System.out.println("slot not available");
      }
    } catch (Exception e) {
      Log.info("Exception " + e.getMessage());
    }
  }