/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { input.setCheckedInternal(input == radioButtonInput); } }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { input.setCheckedInternal(input == radioButtonInput); } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ @SuppressWarnings("unchecked") void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); pageInputs.removeAll(formInputs); for (final HtmlRadioButtonInput input : pageInputs) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ @SuppressWarnings("unchecked") void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); pageInputs.removeAll(formInputs); for (final HtmlRadioButtonInput input : pageInputs) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ @SuppressWarnings("unchecked") void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = (List<HtmlRadioButtonInput>) getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = (List<HtmlRadioButtonInput>) getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); pageInputs.removeAll(formInputs); for (final HtmlRadioButtonInput input : pageInputs) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ private void setCheckedForPage(final HtmlPage htmlPage) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = htmlPage.getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = htmlPage.getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + getNameAttribute() + "']"); pageInputs.removeAll(formInputs); boolean foundInPage = false; for (final HtmlRadioButtonInput input : pageInputs) { if (input == this) { setCheckedInternal(true); foundInPage = true; } else { input.setCheckedInternal(false); } } if (!foundInPage && !formInputs.contains(this)) { setCheckedInternal(true); } }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ private void setCheckedForPage(final HtmlPage htmlPage) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = htmlPage.getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = htmlPage.getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + getNameAttribute() + "']"); pageInputs.removeAll(formInputs); boolean foundInPage = false; for (final HtmlRadioButtonInput input : pageInputs) { if (input == this) { setCheckedInternal(true); foundInPage = true; } else { input.setCheckedInternal(false); } } if (!foundInPage && !formInputs.contains(this)) { setCheckedInternal(true); } }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }