HtmlButton button = page.getFirstByXPath("//button[@type='submit' and span[text()=='Search']]"); button.click();
/** * {@inheritDoc} */ @Override public NameValuePair[] getSubmitNameValuePairs() { return new NameValuePair[]{new NameValuePair(getNameAttribute(), getValueAttribute())}; }
/** * Sets the content of the {@code value} attribute. * * @param newValue the new content */ public void setValueAttribute(final String newValue) { setAttribute("value", newValue); }
if (inpt.getTypeAttribute().equals("submit") && inpt.getValueAttribute().equals(buttonValue)) { inpt.click(); return;
final String type = getTypeAttribute().toLowerCase(Locale.ROOT); final String formId = getAttributeDirect("form"); if (DomElement.ATTRIBUTE_NOT_DEFINED == formId || !hasFeature(FORM_FORM_ATTRIBUTE_SUPPORTED)) { form = getEnclosingForm(); final DomElement elem = getHtmlPageOrNull().getElementById(formId); if (elem instanceof HtmlForm) { form = (HtmlForm) elem;
/** * {@inheritDoc} */ @Override protected Page doClickAction(final Page defaultPage) throws IOException { final String type = getTypeAttribute().toLowerCase(); final HtmlForm form = getEnclosingForm(); if (form != null) { if (type.equals("submit")) { return form.submit(this); } else if (type.equals("reset")) { return form.reset(); } } return defaultPage; }
if (btn.getValueAttribute().equals(buttonValue) && btn.getTypeAttribute().equals("submit")) { if (form == null) { form = btn.getEnclosingFormOrDie();
if (btn.getTypeAttribute().equals("reset")) { if (form == null) { form = btn.getEnclosingFormOrDie();
submitButton.setAttribute("type", "submit"); searchForm.appendChild(submitButton); HtmlPage newPage = submitButton.click();
/** * Returns the value of the attribute {@code type}. Refer to the * <a href='http://www.w3.org/TR/html401/'>HTML 4.01</a> * documentation for details on the use of this attribute. * * @return the value of the attribute {@code type} or the default value if that attribute isn't defined */ public final String getTypeAttribute() { return getAttribute("type"); }
private boolean isSubmitElement(HtmlElement element) { HtmlElement candidate = null; if (element instanceof HtmlSubmitInput && !((HtmlSubmitInput)element).isDisabled()) candidate = element; else if (element instanceof HtmlImageInput && !((HtmlImageInput)element).isDisabled()) candidate = element; else if (element instanceof HtmlButton) { HtmlButton button = (HtmlButton) element; if ("submit".equalsIgnoreCase(button.getTypeAttribute()) && !button.isDisabled()) candidate = element; } return candidate != null; }
/** * Returns the value of the attribute "type". Refer to the * <a href='http://www.w3.org/TR/html401/'>HTML 4.01</a> * documentation for details on the use of this attribute. Note that Internet * Explorer doesn't follow the spec when the type isn't specified. It will return * "button" rather than the "submit" specified in the spec. * * @return the value of the attribute "type" or the default value if that attribute isn't defined */ public final String getTypeAttribute() { String type = getAttribute("type"); if (type == HtmlElement.ATTRIBUTE_NOT_DEFINED) { final BrowserVersion browser = getPage().getWebClient().getBrowserVersion(); if (browser.isIE()) { type = "button"; } else { type = "submit"; } } return type; }
/** * Returns the {@code type} property. * @return the {@code type} property */ @JsxGetter public String getType() { String type = ((HtmlButton) getDomNodeOrDie()).getTypeAttribute(); if (null != type) { type = type.toLowerCase(Locale.ROOT); } if ("reset".equals(type)) { return "reset"; } if ("submit".equals(type)) { return "submit"; } if ("button".equals(type)) { return "button"; } return "submit"; }
/** * {@inheritDoc} */ @Override public final boolean isDisabled() { return hasAttribute("disabled"); }
element = new HtmlButton(namespaceURI, qualifiedName, page, attributeMap);
/** * Creates a new instance. * * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes the initial attributes */ HtmlButton(final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(qualifiedName, page, attributes); originalName_ = getNameAttribute(); }
final String type = getTypeAttribute().toLowerCase(Locale.ROOT); final String formId = getAttributeDirect("form"); if (DomElement.ATTRIBUTE_NOT_DEFINED == formId || !hasFeature(FORM_FORM_ATTRIBUTE_SUPPORTED)) { form = getEnclosingForm(); final DomElement elem = getHtmlPageOrNull().getElementById(formId); if (elem instanceof HtmlForm) { form = (HtmlForm) elem;
/** * {@inheritDoc} */ @Override protected Page doClickAction(final Page defaultPage) throws IOException { final String type = getTypeAttribute().toLowerCase(); final HtmlForm form = getEnclosingForm(); if (form != null) { if (type.equals("submit")) { return form.submit(this); } else if (type.equals("reset")) { return form.reset(); } } return defaultPage; }
if (btn.getTypeAttribute().equals("submit")) { if (form == null) { form = btn.getEnclosingFormOrDie();
submitButton.setAttribute("type", "submit"); searchForm.appendChild(submitButton); currentPage = submitButton.click();