Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect


        assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text

        //list values
        HtmlForm adhocForm = adhocPage.getFormByName("DasForm");
        //adhocPage.getEnclosingWindow().getWebClient()
        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);
          }
        }
        //System.out.println("allOptionsText:"+allOptionsText);

View Full Code Here


        assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text

        //list values
        HtmlForm commandForm = commandPage.getFormByName("DasForm");
        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);
          }
        }
        assertTrue(-1 != allOptionsText.indexOf("NullCommand"));//check each option
        assertTrue(-1 != allOptionsText.indexOf("AllCompanies"));//check each option
View Full Code Here

        assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text

        //list values
        HtmlForm adhocForm = adhocPage.getFormByName("DasForm");
        //adhocPage.getEnclosingWindow().getWebClient()
        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);
          }
        }
        //System.out.println("allOptionsText:"+allOptionsText);
View Full Code Here

        assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text

        //list values
        HtmlForm commandForm = commandPage.getFormByName("DasForm");
        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);
          }
        }
        assertTrue(-1 != allOptionsText.indexOf("NullCommand"));//check each option
        assertTrue(-1 != allOptionsText.indexOf("AllCompanies"));//check each option
View Full Code Here

  HtmlPage page = getPage("/faces/jsp/selectManyMismatchValue.jsp");
  List list = getAllElementsOfGivenClass(page, null,
                 HtmlSubmitInput.class);
  HtmlSubmitInput button = (HtmlSubmitInput) list.get(0);
  list = getAllElementsOfGivenClass(page, null, HtmlSelect.class);
  HtmlSelect options = (HtmlSelect) list.get(0);
  String chosen [] = {"one", "three"};
  options.fakeSelectedAttribute(chosen);
  page = (HtmlPage) button.click();
  assertTrue(-1 != page.asText().indexOf("one three"));
  assertTrue(-1 != page.asText().indexOf("#{test3.selection}"));
 
    }
View Full Code Here

  HtmlPage page = getPage("/faces/jsp/selectManyInvalidValue.jsp");
  List list = getAllElementsOfGivenClass(page, null,
                 HtmlSubmitInput.class);
  HtmlSubmitInput button = (HtmlSubmitInput) list.get(0);
  list = getAllElementsOfGivenClass(page, null, HtmlSelect.class);
  HtmlSelect options = (HtmlSelect) list.get(0);
  Random random = new Random(4143);
  String str = new String((new Float(random.nextFloat())).toString());

  String chosen [] = {
      (new Float(random.nextFloat())).toString(),
      (new Float(random.nextFloat())).toString()
  };
  options.fakeSelectedAttribute(chosen);
  page = (HtmlPage) button.click();
        ResourceBundle messages = ResourceBundle.getBundle(
            "javax.faces.Messages");
        String message = messages.getString("javax.faces.component.UISelectMany.INVALID");
  // it does have a validation message
View Full Code Here

        HtmlPage page = getPage("/faces/jsp/selectOneTypeInt.jsp");
        List list = getAllElementsOfGivenClass(page, null,
                                               HtmlSubmitInput.class);
        HtmlSubmitInput button = (HtmlSubmitInput) list.get(0);
        list = getAllElementsOfGivenClass(page, null, HtmlSelect.class);
        HtmlSelect options = (HtmlSelect) list.get(0);
                                                                                                   
        String chosen = "2";
        options.fakeSelectedAttribute(chosen);
        page = (HtmlPage) button.click();
        ResourceBundle messages = ResourceBundle.getBundle(
            "javax.faces.Messages");
        String message = messages.getString("javax.faces.component.UISelectMany.INVALID");
        // it does not have a validation message
View Full Code Here

        HtmlPage page = getPage("/faces/jsp/selectManyTypeInts.jsp");
        List list = getAllElementsOfGivenClass(page, null,
                                               HtmlSubmitInput.class);
        HtmlSubmitInput button = (HtmlSubmitInput) list.get(0);
        list = getAllElementsOfGivenClass(page, null, HtmlSelect.class);
        HtmlSelect options = (HtmlSelect) list.get(0);
                                                                                                   
        String chosen [] = {"2", "3"};
        options.fakeSelectedAttribute(chosen);
        page = (HtmlPage) button.click();
        ResourceBundle messages = ResourceBundle.getBundle(
            "javax.faces.Messages");
        String message = messages.getString("javax.faces.component.UISelectMany.INVALID");
        // it does not have a validation message
View Full Code Here

    // ------------------------------------------------- Individual Test Methods


    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");
       
View Full Code Here

    public void testConverterForUISelectMany() throws Exception {
        HtmlPage page = getPage("/faces/SelectManyConverterTest.jsp");
        List selects = getAllElementsOfGivenClass(page,
                                                  new ArrayList(),
                                                  HtmlSelect.class);
        HtmlSelect select = (HtmlSelect) selects.get(0);
        HtmlSelect select2 = (HtmlSelect) selects.get(1);
        select.getOption(1).setSelected(true);
        select.getOption(2).setSelected(true);
        select2.getOption(1).setSelected(true);
        select2.getOption(2).setSelected(true);
       
        HtmlSubmitInput submit = (HtmlSubmitInput) getInputContainingGivenId(page,
                                                                             "submit");
        page = (HtmlPage) submit.click();
       
View Full Code Here

TOP

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

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.