Examples of HtmlOption


Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

   * @return The option element corresponding to the specified text
   */
  private HtmlOption getOptionForText(final HtmlSelect select, final String text) {
    final IStringVerifier verifier = getVerifier(fIsRegex);
    for (final Iterator iter = select.getOptions().iterator(); iter.hasNext();) {
      final HtmlOption option = (HtmlOption) iter.next();
      LOG.debug("Examining option: " + option);
      if (verifier.verifyStrings(text, option.asText())) {
        LOG.debug("Found option by text: " + option);
        return option;
      }
    }
    throw new StepFailedException("No option element found with text \"" + text + "\"", this);
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

  }

  protected void verifyField(final HtmlElement field) throws IOException {
    final HtmlSelect curSelect = (HtmlSelect) field;
    for (final Iterator iter = curSelect.getOptions().iterator(); iter.hasNext();) {
      final HtmlOption curOption = (HtmlOption) iter.next();

      if ((getText() == null || verifyStrings(getText(), curOption.asText()))
        && (getValue() == null || verifyStrings(getValue(), curOption.getValueAttribute()))) {
        LOG.debug("Found corresponding option " + curOption);
        if (curOption.isSelected()) {
          return;
        }
        throw new StepFailedException(getStepLabel() + ": " + buildFailMessage(getValue()), this);
      }
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

        HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery");
        List adhocListOptions = adhocList.getOptions();//.asText();
        //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString());
        String allOptionsText = "";
        for(int i=0; i<adhocListOptions.size(); i++){
          HtmlOption curOption = (HtmlOption)adhocListOptions.get(i);
          String curOptionText = curOption.getValueAttribute();
          allOptionsText = allOptionsText + curOptionText;
          if(curOptionText.equals("SELECT * FROM COMPANY")){
            adhocList.setSelectedAttribute(curOption, true);
            //System.out.println("select option..."+curOptionText);
          }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

        HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand");
        List commandListOptions = commandList.getOptions();
        //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString());
        String allOptionsText = "";
        for(int i=0; i<commandListOptions.size(); i++){
          HtmlOption curOption = (HtmlOption)commandListOptions.get(i);
          String curOptionText = curOption.getValueAttribute();
          allOptionsText = allOptionsText + curOptionText;
          if(curOptionText.equals("AllCompaniesAndDepartments")){
            commandList.setSelectedAttribute(curOption, true);
            //System.out.println("select option..."+curOptionText);
          }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

        HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery");
        List adhocListOptions = adhocList.getOptions();//.asText();
        //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString());
        String allOptionsText = "";
        for(int i=0; i<adhocListOptions.size(); i++){
          HtmlOption curOption = (HtmlOption)adhocListOptions.get(i);
          String curOptionText = curOption.getValueAttribute();
          allOptionsText = allOptionsText + curOptionText;
          if(curOptionText.startsWith("{INSERT INTO DEPARTMENT (NAME, COMPANYID) VALUES ('MyDept',1)}" )){
            adhocList.setSelectedAttribute(curOption, true);
            //System.out.println("insert option..."+curOptionText);
          }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

        HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand");
        List commandListOptions = commandList.getOptions();
        //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString());
        String allOptionsText = "";
        for(int i=0; i<commandListOptions.size(); i++){
          HtmlOption curOption = (HtmlOption)commandListOptions.get(i);
          String curOptionText = curOption.getValueAttribute();
          allOptionsText = allOptionsText + curOptionText;
          if(curOptionText.equals("DeleteDepartmentFromFirstCompany")){
            commandList.setSelectedAttribute(curOption, true);
            //System.out.println("delete option..."+curOptionText);
          }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

    public void testModelCoercionForUISelectOne() throws Exception {
        HtmlPage page = getPage("/faces/ModelSelectItemConversion.jsp");
        HtmlSelect select = (HtmlSelect) getAllElementsOfGivenClass(page,
                                                                    new ArrayList(),
                                                                    HtmlSelect.class).get(0);
        HtmlOption option = select.getOption(1);
        option.setSelected(true);
       
        HtmlSubmitInput submit = (HtmlSubmitInput) getInputContainingGivenId(page,
                                                                             "submit");
       
        // clicking this should yield no errors.
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

    assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display: none;"));
    assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
    assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));

    //selecting an album from drop down
    HtmlOption option = select.getOption(1);
    option.click();
    Thread.sleep(3000);
    //testing whether the expected changes has happened
    assertTrue(select.asText().contains("boston"));
    assertTrue(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc"));
   
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

    assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display: none;"));
    assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
    assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));

    //selecting an album from drop down
    HtmlOption option = select.getOption(1);
    option.click();
    Thread.sleep(3000);
    //testing whether the expected changes has happened
    assertTrue(select.asText().contains("boston"));
    assertTrue(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc"));
   
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlOption

    assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display: none;"));
    assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
    assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));

    //selecting an album from drop down
    HtmlOption option = select.getOption(1);
    option.click();
    Thread.sleep(3000);
    //testing whether the expected changes has happened
    assertTrue(select.asText().contains("boston"));
    assertTrue(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc"));
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.