WebClient client = new WebClient(); HtmlPage page = client.getPage("http://stackoverflow.com"); // create a submit button - it doesn't work with 'input' HtmlElement button = page.createElement("button"); button.setAttribute("type", "submit"); // append the button to the form HtmlElement form = ...; form.appendChild(button); // submit the form page = button.click();
/** * Sets the content of the {@code value} attribute. * * @param newValue the new value */ public void setValueAttribute(final String newValue) { WebAssert.notNull("newValue", newValue); super.setAttribute("value", newValue); }
/** * Sets the {@code height} property. * @param height the {@code height} property */ @JsxSetter public void setHeight(final int height) { getDomNodeOrDie().setAttribute("height", Integer.toString(height)); }
/** * Sets the value of the {@code width} property. * @param width the value of the {@code width} property */ @JsxSetter(propertyName = "width") public void setWidthString(final String width) { getDomNodeOrDie().setAttribute("width", width); }
/** * Sets the {@code lang} property. * @param lang the {@code lang} property */ @JsxSetter public void setLang(final String lang) { getDomNodeOrDie().setAttribute("lang", lang); }
/** * Sets the {@code language} property. * @param language the {@code language} property */ @JsxSetter(IE) public void setLanguage(final String language) { getDomNodeOrDie().setAttribute("language", language); }
/** * Sets the {@code contentEditable} property. * @param contentEditable the {@code contentEditable} property to set */ @JsxSetter public void setContentEditable(final String contentEditable) { getDomNodeOrDie().setAttribute("contentEditable", contentEditable); }
/** * Sets the {@code type} property. * @param type the {@code type} property */ @JsxSetter public void setType(final String type) { getDomNodeOrDie().setAttribute("type", type); }
/** * Sets the {@code border} attribute. * @param border the {@code border} attribute */ @JsxSetter(IE) public void setBorder(final String border) { getDomNodeOrDie().setAttribute("border", border); }
/** * Returns the value of the {@code cite} property. * @param cite the value */ @JsxSetter public void setCite(final String cite) { getDomNodeOrDie().setAttribute("cite", cite); }
/** * Sets {@code version} property. * @param version the {@code version} property */ @JsxSetter public void setVersion(final String version) { getDomNodeOrDie().setAttribute("version", version); }
/** * Sets the {@code http-equiv} attribute. * @param httpEquiv the http-equiv attribute */ @JsxSetter public void setHttpEquiv(final String httpEquiv) { getDomNodeOrDie().setAttribute("http-equiv", httpEquiv); }
/** * Sets the {@code src} attribute. * @param src the {@code src} attribute value */ @JsxSetter public void setSrc(final String src) { final HtmlElement img = getDomNodeOrDie(); img.setAttribute("src", src); }
/** * Sets the value of the {@code alt} property. * @param alt the value */ @JsxSetter public void setAlt(final String alt) { getDomNodeOrDie().setAttribute("alt", alt); }
/** * Sets the value of the {@code abbr} attribute. * @param abbr the value of the {@code abbr} attribute */ @JsxSetter public void setAbbr(final String abbr) { getDomNodeOrDie().setAttribute("abbr", abbr); }
/** * Sets the {@code border} property. * @param border the {@code border} property */ @JsxSetter public void setBorder(final String border) { getDomNodeOrDie().setAttribute("border", border); }
/** * Sets the {@code color} attribute. * @param color the {@code color} attribute */ @JsxSetter public void setColor(final String color) { getDomNodeOrDie().setAttribute("color", color); }
/** * Sets the rel property. * @param rel rel attribute value */ @JsxSetter public void setRel(final String rel) { getDomNodeOrDie().setAttribute("rel", rel); }
/** * Sets the {@code ping} attribute. * @param ping {@code ping} attribute */ @JsxSetter({CHROME, FF}) public void setPing(final String ping) { getDomNodeOrDie().setAttribute("ping", ping); }
/** * Sets the value of the JavaScript attribute {@code name}. * * @param newName the new name */ @JsxSetter public void setName(final String newName) { getDomNodeOrDie().setAttribute("name", newName); }