Package com.gargoylesoftware.htmlunit.html

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


        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

        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

    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

    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

    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

    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

    }
    if ("index".equals(lowerName) && element instanceof HtmlOption) {
      HtmlSelect select = ((HtmlOption) element).getEnclosingSelect();
      List<HtmlOption> allOptions = select.getOptions();
      for (int i = 0; i < allOptions.size(); i++) {
        HtmlOption option = select.getOption(i);
        if (element.equals(option)) {
          return String.valueOf(i);
        }
      }
View Full Code Here

        element.click();
        return isSelected();
      }

      if (element instanceof HtmlOption) {
        HtmlOption option = (HtmlOption) element;
        HtmlSelect select = option.getEnclosingSelect();
        if (select.isMultipleSelectEnabled()) {
          option.setSelected(!option.isSelected());
          return isSelected();
        }
      }

      throw new UnsupportedOperationException(
View Full Code Here

     * @param newOptionObject the DomNode to insert
     * @param index (optional) the index where the node should be inserted
     */
    protected void add_IE(final HTMLOptionElement newOptionObject, final Object index) {
        final HtmlSelect select = getHtmlSelect();
        final HtmlOption beforeOption;
        if (Context.getUndefinedValue().equals(index)) {
            beforeOption = null;
        }
        else {
            final int intIndex = ((Integer) Context.jsToJava(index, Integer.class)).intValue();
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.HtmlOption

Copyright © 2018 www.massapicom. 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.