コード例 #1
0
  @Test
  @Ignore(MARIONETTE)
  public void shouldAllowUserToDeselectAllWhenSelectSupportsMultipleSelections() {
    WebElement selectElement = driver.findElement(By.name("multi"));
    Select select = new Select(selectElement);
    select.deselectAll();
    List<WebElement> returnedOptions = select.getAllSelectedOptions();

    assertEquals(0, returnedOptions.size());
  }
コード例 #2
0
  // odi.623.Method for DNIS value search
  public void dnisfilter() {
    String dmName = "US_AIRWAYS";
    gotoreports(dmName);
    try {
      WebElement DNISvalue = driver.findElement(By.id("PARAM_DNIS"));
      Select select = new Select(DNISvalue);
      select.deselectAll();
      select.selectByValue("2404953077");
      driver
          .manage()
          .timeouts()
          .implicitlyWait(
              20,
              TimeUnit
                  .SECONDS); // submit should be clickable if delay is there in selecting the DNIS
      driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
      new WebDriverWait(driver, 10)
          .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("reportContent"));
      WebElement page =
          new WebDriverWait(driver, 10)
              .until(ExpectedConditions.visibilityOfElementLocated(By.id("CrystalViewer")));
      WebElement tag = page.findElement(By.xpath("//*[contains(text(),'2404953077')]"));
      if (tag != null) {
        System.out.println("DNIS:2404953077 filter is present");
        ReportFile.addTestCase(
            "ODI6.x-623:DNIS filter: selected DNIS filter should be shown in report result",
            "ODI6.x-623:DNIS filter: selected DNIS filter should be shown in report result => Pass");
      }

    } catch (Exception e) {
      System.out.print("trace: ");
      e.printStackTrace();
    }
    // driver.quit();
    ReportFile.WriteToFile();
    driver.switchTo().defaultContent();
  }
コード例 #3
0
 @Test(expected = UnsupportedOperationException.class)
 public void shouldNotAllowUserToDeselectAllWhenSelectDoesNotSupportMultipleSelections() {
   WebElement selectElement = driver.findElement(By.name("selectomatic"));
   Select select = new Select(selectElement);
   select.deselectAll();
 }
コード例 #4
0
 public MultiSelect selectByIndex(Supplier<By> by, Integer... indices) {
   Select select = new Select(findElement(by));
   select.deselectAll();
   Arrays.stream(indices).forEach(select::selectByIndex);
   return this;
 }
コード例 #5
0
 public MultiSelect selectByValue(Supplier<By> by, String... values) {
   Select select = new Select(findElement(by));
   select.deselectAll();
   Arrays.stream(values).forEach(select::selectByValue);
   return this;
 }
コード例 #6
0
 public MultiSelect selectByText(Supplier<By> by, String... texts) {
   Select select = new Select(findElement(by));
   select.deselectAll();
   Arrays.stream(texts).forEach(select::selectByVisibleText);
   return this;
 }