Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput


  
   private void clickRadio(String componentID) throws IOException
   {
      String itemValue = getSelectItemValue(componentID);
      String parentID = parentElementClientID(componentID);
      HtmlRadioButtonInput radioInput = findRadioInput(parentID, itemValue);
      radioInput.click();
   }
View Full Code Here


    }
    return li;
  }

  protected void verifyField(final HtmlElement element) {
    HtmlRadioButtonInput radioButton = (HtmlRadioButtonInput) element;
    if (radioButton.isChecked() != ConversionUtil.convertToBoolean(getChecked(), false)) {
      throw new StepFailedException("RadioButton is " + (radioButton.isChecked() ? "" : "not") + "checked!", this);
    }
  }
View Full Code Here

        assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text

        //list values
        HtmlForm commandForm = commandPage.getFormByName("DasForm");
        //select first radio buttom
        HtmlRadioButtonInput stmt0 = (HtmlRadioButtonInput)commandForm.getRadioButtonInput("stmt", "stmt0");
        if(stmt0 != null){
          //System.out.println("got stmt0");
          stmt0.setChecked(true);
        }

        //check result
        HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("converterButton");
        HtmlPage commandResult = null;
View Full Code Here

    }
   
    public void testSelectOneRadioTypeInt() throws Exception {
        HtmlPage page = getPage("/faces/jsp/selectOneRadioTypeInt.jsp");
        HtmlSubmitInput nonImmediateButton = null, immediateButton = null;
        HtmlRadioButtonInput radio1 = null, radio2 = null, radio3 = null;
        List submitList = getAllElementsOfGivenClass(page, null, HtmlSubmitInput.class);
        List radioList = getAllElementsOfGivenClass(page, null, HtmlRadioButtonInput.class);
        radio1 = (HtmlRadioButtonInput) radioList.get(0);
        radio2 = (HtmlRadioButtonInput) radioList.get(1);
        radio3 = (HtmlRadioButtonInput) radioList.get(2);
        for (int i = 0; i < submitList.size(); i++) {
            HtmlSubmitInput result = (HtmlSubmitInput) submitList.get(i);
            if (-1 != result.getIdAttribute().indexOf("nonImmediate")) {
                nonImmediateButton = result;
            } else {
                immediateButton = result;
            }
        }
        assertTrue(-1 != page.asText().indexOf("Model Selection:3"));

        // now press the immediate button and verify that our original
        // selection is there...
        page = (HtmlPage) immediateButton.click();
        assertTrue(-1 != page.asText().indexOf("Model Selection:3"));

        // now click the first radio option...
        radio1.setChecked(true);
        // now press the immediate button and verify that our original
        // selection is there...
        page = (HtmlPage) immediateButton.click();
        assertTrue(-1 != page.asText().indexOf("Model Selection:3"));

        // now click the first radio option...
        radio1.setChecked(true);
        // now press the non immediate button and verify that our new
        // selection is there...
        page = (HtmlPage) nonImmediateButton.click();
        assertTrue(-1 != page.asText().indexOf("Model Selection:1"));
    }
View Full Code Here

  List list = getAllElementsOfGivenClass(page, null,
                 HtmlSubmitInput.class);
  HtmlSubmitInput button = (HtmlSubmitInput) list.get(0);
  list = getAllElementsOfGivenClass(page, null,
            HtmlRadioButtonInput.class);
  HtmlRadioButtonInput radio = (HtmlRadioButtonInput) list.get(0);
  radio.setChecked(true);
  page = (HtmlPage) button.click();
        ResourceBundle messages = ResourceBundle.getBundle("javax.faces.Messages");
        String message = messages.getString("javax.faces.component.UIInput.REQUIRED");
  // it does not have a validation error
  assertTrue(-1 == page.asText().indexOf(message));
View Full Code Here

    // when button with immediate="true" is pressed.
    //
    public void testSelectOneRadioTypeInteger() throws Exception {
        HtmlPage page = getPage("/faces/jsp/selectOneRadioTypeInteger.jsp");
        HtmlSubmitInput nonImmediateButton = null, immediateButton = null;
        HtmlRadioButtonInput radio1 = null, radio2 = null, radio3 = null;
        List submitList = getAllElementsOfGivenClass(page, null, HtmlSubmitInput.class);
        List radioList = getAllElementsOfGivenClass(page, null, HtmlRadioButtonInput.class);
        radio1 = (HtmlRadioButtonInput) radioList.get(0);
        radio2 = (HtmlRadioButtonInput) radioList.get(1);
        radio3 = (HtmlRadioButtonInput) radioList.get(2);
        for (int i = 0; i < submitList.size(); i++) {
            HtmlSubmitInput result = (HtmlSubmitInput) submitList.get(i);
            if (-1 != result.getIdAttribute().indexOf("nonImmediate")) {
                nonImmediateButton = result;
            } else {
                immediateButton = result;
            }
        }
        assertTrue(-1 != page.asText().indexOf("Model Selection:2"));

        // now press the immediate button and verify that our original
        // selection is there...
        page = (HtmlPage) immediateButton.click();
        assertTrue(-1 != page.asText().indexOf("Model Selection:2"));

        // now click the first radio option...
        radio1.setChecked(true);
        // now press the immediate button and verify that our original
        // selection is there...
        page = (HtmlPage) immediateButton.click();
        assertTrue(-1 != page.asText().indexOf("Model Selection:2"));

        // now click the first radio option...
        radio1.setChecked(true);
        // now press the non immediate button and verify that our new
        // selection is there...
        page = (HtmlPage) nonImmediateButton.click();
        assertTrue(-1 != page.asText().indexOf("Model Selection:1"));
    }
View Full Code Here

        assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text

        //list values
        HtmlForm commandForm = commandPage.getFormByName("DasForm");
        //select first radio buttom
        HtmlRadioButtonInput stmt0 = (HtmlRadioButtonInput)commandForm.getRadioButtonInput("stmt", "stmt0");
        if(stmt0 != null){
          //System.out.println("got stmt0");
          stmt0.setChecked(true);
        }

        //check result
        HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("converterButton");
        HtmlPage commandResult = null;
View Full Code Here

        HtmlForm form = page.getFormByName(newServerFormName);

        form.getInputByName(inputFormName).setValueAttribute(serverName);

        List<HtmlRadioButtonInput> radioButtons = form.getRadioButtonsByName(radioButtonName);
        HtmlRadioButtonInput radioButtonDefaultConfig = null;
        for (HtmlRadioButtonInput button : radioButtons) {
            if (radioButtonDefaultConfigValue.equals(button.getValueAttribute())) {
                radioButtonDefaultConfig = button;
                radioButtonDefaultConfig.setChecked(true);
            }
        }
        assertTrue("Failed to choose 'GerritServer with Default Configurations'", radioButtonDefaultConfig.isChecked());

        form.submit(null);
    }
View Full Code Here

        HtmlForm form = page.getFormByName(newServerFormName);

        form.getInputByName(inputFormName).setValueAttribute(newServerName);

        List<HtmlRadioButtonInput> radioButtons = form.getRadioButtonsByName(radioButtonName);
        HtmlRadioButtonInput radioButtonCopy = null;
        for (HtmlRadioButtonInput button : radioButtons) {
            if (radioButtonCopyValue.equals(button.getValueAttribute())) {
                radioButtonCopy = button;
                radioButtonCopy.setChecked(true);
            }
        }
        assertTrue("Failed to choose 'Copy from Existing Server Configurations'", radioButtonCopy.isChecked());

        form.getInputByName(fromInputFormName).setValueAttribute(fromServerName);

        form.submit(null);
    }
View Full Code Here

TOP

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

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.