コード例 #1
0
 private void TypesOfSchool() throws IOException {
   // Click Type of School
   driver.findElement(By.cssSelector("strong")).click();
   // Click Private
   driver.findElement(By.id("edit-public-private-private")).click();
   // Move School Size Slider
   // TODO Slider not working properly
   WebElement Slider1 = driver.findElement(By.id("population_jq_slider"));
   Actions moveSlider1 = new Actions(driver);
   Action action1 = moveSlider1.dragAndDropBy(Slider1, 0, 10).build();
   action1.perform();
   // Select Religious Affiliation
   new Select(driver.findElement(By.id("edit-religious-affiliation")))
       .selectByVisibleText("Church of Christ");
   // Move Tuition Range Slider
   // TODO Slider not working properly
   WebElement Slider2 = driver.findElement(By.id("tuition_range_jq_slider"));
   Actions moveSlider2 = new Actions(driver);
   Action action2 = moveSlider2.dragAndDropBy(Slider2, 0, 10).build();
   action2.perform();
   // Click Apply
   driver.findElement(By.id("edit-type-of-school-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();
 }
コード例 #2
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();
 }
コード例 #3
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();
 }
コード例 #4
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();
 }
コード例 #5
0
 private void SpecialNeeds() throws IOException {
   // Click Special Needs
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Special Needs\")]"))
       .click();
   // Select Special Needs
   Select SpecialNeeds = new Select(driver.findElement(By.id("edit-special-needs")));
   // Select Learning Center
   SpecialNeeds.selectByVisibleText("Learning Center");
   // Select Early Syllabus
   SpecialNeeds.selectByVisibleText("Early syllabus");
   // Click Apply
   driver.findElement(By.id("edit-special-needs-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();
 }
コード例 #6
0
ファイル: DemoGuiWebTest.java プロジェクト: pvf70/OsBiToolsWs
  private void checkDemoPage(String lang) throws InterruptedException {
    checkElementVisible("page_loader", false);
    checkElementVisible("login_widget", false);
    checkElementVisible("webapp_ctx", true);
    checkElementVisible("error_window", false);
    checkElementVisible("success_window", true);

    // Extra check
    checkWidgetsOnLogin();

    // Check success message
    assertEquals(
        "Success message doesn't match",
        getLabelText(lang, "LL_DEMO_MSG"),
        driver.findElement(By.id("ok_msg")).getText());
    // Click on close button
    driver.findElement(By.id("success_window")).findElement(By.className("b-close")).click();

    Thread.sleep(1000);

    checkElementVisible("webapp_ctx", true);
    checkElementVisible("error_window", false);
    checkElementVisible("success_window", false);

    // Check color of message
    WebElement dmsg = driver.findElement(By.className("demo"));
    assertEquals(
        "demo message color doesn't match", "rgba(128, 128, 128, 1)", dmsg.getCssValue("color"));

    checkButtonById(lang, "ll_error", true);
    checkButtonById(lang, "ll_logout", true);

    // Check &  Press error button
    WebElement err = driver.findElement(By.id("ll_error"));
    err.click();
    Thread.sleep(500);
    checkErrorWin(
        lang,
        "C-DEMO",
        getLabelText(lang, "LL_INFO_MSG"),
        getLabelText(lang, "LL_DETAIL_MSG_1") + "\n" + getLabelText(lang, "LL_DETAIL_MSG_2"));
  }
コード例 #7
0
 private void SearchButton() throws IOException {
   // Enter Text To Be Search
   driver.findElement(By.id("edit-keys")).clear();
   driver.findElement(By.id("edit-keys")).sendKeys("Abilene");
   // Click Search
   driver.findElement(By.id("edit-submit")).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();
 }
コード例 #8
0
  @Ignore // Ignored because you need to kickstart Python SimpleHTTPServer before it can run
  @Test
  public void shouldSwitchToTheRightFrame_issue226() {
    // NOTE: before starting this test,
    // run `python -m SimpleHTTPServer` from within `test/testcase-issue_226`.
    // This will launch a minimal webserver to serve the pages for this test.
    WebDriver d = getDriver();

    // Load "outside.html" and check it's the right one
    d.get("http://localhost:8000/outside.html");
    assertTrue(d.getPageSource().contains("Editing testDotAtEndDoesNotDelete"));
    assertEquals(2, d.findElements(By.tagName("iframe")).size());

    // Find the iframe with class "gwt-RichTextArea"
    WebElement iframeRichTextArea = d.findElement(By.className("gwt-RichTextArea"));

    // Switch to the iframe via WebElement and check it's the right one
    d.switchTo().frame(iframeRichTextArea);
    assertEquals(0, d.findElements(By.tagName("title")).size());
    assertFalse(d.getPageSource().contains("Editing testDotAtEndDoesNotDelete"));
    assertEquals(0, d.findElements(By.tagName("iframe")).size());

    // Switch back to the main frame and check it's the right one
    d.switchTo().defaultContent();
    assertEquals(2, d.findElements(By.tagName("iframe")).size());

    // Switch again to the iframe, this time via it's "frame number" (i.e. 0 to n)
    d.switchTo().frame(0);
    assertEquals(0, d.findElements(By.tagName("title")).size());
    assertFalse(d.getPageSource().contains("Editing testDotAtEndDoesNotDelete"));
    assertEquals(0, d.findElements(By.tagName("iframe")).size());

    // Switch back to the main frame and check it's the right one
    d.switchTo().defaultContent();
    assertEquals(2, d.findElements(By.tagName("iframe")).size());

    // Switch to the second frame via it's "frame number"
    d.switchTo().frame(1);
    assertEquals(1, d.findElements(By.tagName("title")).size());
    assertEquals(0, d.findElements(By.tagName("iframe")).size());
    assertTrue(d.getPageSource().contains("WYSIWYG Editor Input Template"));

    // Switch again to the main frame
    d.switchTo().defaultContent();
    assertEquals(2, d.findElements(By.tagName("iframe")).size());
  }
コード例 #9
0
 private void Sports() throws IOException {
   // Click Sports
   driver
       .findElement(
           By.xpath("//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Sports\")]"))
       .click();
   // Select Sports
   Select Sports = new Select(driver.findElement(By.id("edit-varsity-sports")));
   // Select Baseball
   Sports.selectByVisibleText("baseball");
   // Select Basketball
   Sports.selectByVisibleText("basketball");
   // Click Apply
   driver.findElement(By.id("edit-varsity-sports-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();
 }