Examples of HtmlSelect


Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

     //queryPage = (HtmlPage) wb.getPage(wb.getCurrentWindow(), wrs);
     //System.out.println(queryPage.getPageEncoding());
    
     //Estado
     HtmlForm form = queryPage.getFormByName("AG");
     HtmlSelect select = form.getSelectByName("S7_");
     List<HtmlOption> listEstadoOptions = select.getOptions();
     for(int i=1; i< listEstadoOptions.size(); i++){
       select.setSelectedAttribute(Integer.toString(i), true);
       System.out.println("numEstado"+i);
       System.out.println("estado"+listEstadoOptions.get(i).asText());
          //Area (Somente as de engenharia: 20 a 23)
       queryPage = (HtmlPage) wb.getPage(queryUrl);
       form = queryPage.getFormByName("AG");
       select = form.getSelectByName("S11_");
       List<HtmlOption> listAreaOptions = select.getOptions();
       for(int j=20; j< 24; j++){//So engenharia
         select.setSelectedAttribute(Integer.toString(j), true);
         System.out.println("numArea"+j);
         System.out.println("area"+listAreaOptions.get(j).asText());
         //IEF
         queryPage = (HtmlPage) wb.getPage(queryUrl);
         form = queryPage.getFormByName("AG");
         select = form.getSelectByName("S9_");
         List<HtmlOption> listIefOptions = select.getOptions();
         for(int k=1; k< listIefOptions.size(); k++){
           select.setSelectedAttribute(Integer.toString(k), true);
           System.out.println("numIef"+k);
           System.out.println("ief"+listIefOptions.get(k).asText());
           //Programa
           queryPage = (HtmlPage) wb.getPage(queryUrl);
           form = queryPage.getFormByName("AG");
           select = form.getSelectByName("S13_");
           List<HtmlOption> listProgramaOptions = select.getOptions();
           for(int m=1; m< listProgramaOptions.size(); m++){
             System.out.println("m"+m);
             select.setSelectedAttribute(Integer.toString(m), true);
             System.out.println("numPrograma"+m);
             System.out.println("programa"+listProgramaOptions.get(m).asText());
             corrente = new Programa();
             corrente.setNumEstado(i);
             String estado = listEstadoOptions.get(i).asText();
             corrente.setEstado(estado);
             corrente.setNumAreaAvaliacao(j);
             String areaAvaliacao = listAreaOptions.get(j).asText();
             corrente.setAreaAvaliacao(areaAvaliacao);
             corrente.setNumIef(k);
             String ief = listIefOptions.get(k).asText();
             corrente.setIef(ief);
             String programa = listProgramaOptions.get(m).asText();
             corrente.setNumPrograma(m);
             corrente.setPrograma(programa);
             listaDeProgramas.add(corrente);
             System.out.println(i+estado+" "+j+areaAvaliacao+" "+k+ief+" "+m+programa);
             programaDAO.insert(corrente);
            
             //queryPage = (HtmlPage) wb.getPage(wb.getCurrentWindow(), wrs);
             //form = queryPage.getFormByName("AG");
             //select = form.getSelectByName("S13_");
             //listProgramaOptions = select.getOptions();
           }
           //Ief
           queryPage = (HtmlPage) wb.getPage(queryUrl)
           form = queryPage.getFormByName("AG");
           select = form.getSelectByName("S9_");
           listIefOptions = select.getOptions();
         }
         //Area
         queryPage = (HtmlPage) wb.getPage(queryUrl);
         form = queryPage.getFormByName("AG");
         select = form.getSelectByName("S11_");
         listAreaOptions = select.getOptions();
       }
       //Estado
       queryPage = (HtmlPage) wb.getPage(queryUrl)
       form = queryPage.getFormByName("AG");
       select = form.getSelectByName("S7_");
       listEstadoOptions = select.getOptions();
     }
    
    } 
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

   System.out.println("Aqui2");
   HtmlPage queryPage = (HtmlPage) wb.getPage(queryUrl)
   System.out.println("Aqui0");
   //Estado
   HtmlForm form = queryPage.getFormByName("AG");
   HtmlSelect Select = form.getSelectByName("S7_");
   Select.setSelectedAttribute("6", true);
   List<HtmlOption> list = Select.getOptions();
   /*for(HtmlOption ho: list){
     System.out.println(ho.asText());
   }
   System.out.println(queryPage.asText());
   */
   System.out.println("Aqui1");
   //IEF
   queryPage = (HtmlPage) wb.getPage(queryUrl);
   form = queryPage.getFormByName("AG");
   Select = form.getSelectByName("S9_");
   Select.setSelectedAttribute("1", true);
   list = Select.getOptions();
   /*for(HtmlOption ho: list){
     System.out.println(ho.asText());
   }
   System.out.println(queryPage.asText());
   */
  
   //Area
   queryPage = (HtmlPage) wb.getPage(queryUrl);
   form = queryPage.getFormByName("AG");
   Select = form.getSelectByName("S11_");
   Select.setSelectedAttribute("10", true);
   list = Select.getOptions();
   /*for(HtmlOption ho: list){
     System.out.println(ho.asText());
   }
   System.out.println(queryPage.asText());
   */
  
//Programa
   queryPage = (HtmlPage) wb.getPage(queryUrl);
   form = queryPage.getFormByName("AG");
   Select = form.getSelectByName("S13_");
   Select.setSelectedAttribute("1", true);
   list = Select.getOptions();
   /*for(HtmlOption ho: list){
     System.out.println(ho.asText());
   }*/
   System.out.println(queryPage.asText());
  
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

  protected List findFields(final HtmlForm form) {
    return form.getSelectsByName(getName());
  }

  protected void setField(final HtmlElement elt) {
    final HtmlSelect select;
    final HtmlOption option;
    if (elt instanceof HtmlOption)
    {
      option = (HtmlOption) elt;
      select = (HtmlSelect) option.getEnclosingElement(HtmlConstants.SELECT); // TODO: can be simplified with next htmlunit build
    }
    else if (elt instanceof HtmlSelect)
    {
      select = (HtmlSelect) elt;
      // if htmlId or xpath specified, we know now first that text, value or optionIndex is needed
      if (getText() == null && getOptionIndex() == null && getValue() == null)
        throw new StepExecutionException(MESSAGE_MISSING_OPTION_IDENTIFIER, this);
      option = findMatchingOption(select);
    }
    else
    {
      throw new StepFailedException("Found " + elt.getTagName() +
        " when looking for select", this);
    }

    if (select.isMultipleSelectEnabled() && !fIsMultiSelect) {
      deselectOtherOptions(select, option);
    }
    updateOption(select, option);
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

  protected List findFields(final HtmlForm form) {
    return form.getSelectsByName(getName());
  }

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

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

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

        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

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.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

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

        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

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

  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

Examples of com.gargoylesoftware.htmlunit.html.HtmlSelect

  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
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.