public void setTextContent(String value) { if (element instanceof HtmlTextArea) { ((HtmlTextArea) element).setText(value); } else { element.setTextContent(value); } }
/** * Sets the value of the "value" attribute. * @param value the new value */ @Override public void jsxSet_value(final String value) { ((HtmlTextArea) getDomNodeOrDie()).setText(value); }
/** * Sets the value of the "value" attribute. * @param value the new value */ @Override public void jsxSet_value(final String value) { ((HtmlTextArea) getDomNodeOrDie()).setText(value); }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ public void reset() { initDefaultValue(); setText(defaultValue_); }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ public void reset() { initDefaultValue(); setText(defaultValue_); }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ @Override public void reset() { initDefaultValue(); setText(defaultValue_); }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ public void reset() { initDefaultValue(); setText(defaultValue_); }
/** * Sets the value of the "value" attribute. * @param value the new value */ @Override public void jsxSet_value(final String value) { ((HtmlTextArea) getDomNodeOrDie()).setText(value); }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ @Override public void reset() { initDefaultValue(); setText(defaultValue_); }
public void clear() { assertElementNotStale(); if (element instanceof HtmlInput) { ((HtmlInput)element).setValueAttribute(""); } else if (element instanceof HtmlTextArea) { ((HtmlTextArea) element).setText(""); } }
/** * Sets the value of the {@code value} attribute. * @param value the new value */ @Override public void setValue(final Object value) { if (null == value && getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_VALUE_NULL)) { ((HtmlTextArea) getDomNodeOrDie()).setText(""); return; } ((HtmlTextArea) getDomNodeOrDie()).setText(Context.toString(value)); }
/** * Sets the value of the {@code value} attribute. * @param value the new value */ @Override public void setValue(final Object value) { if (null == value && getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_VALUE_NULL)) { ((HtmlTextArea) getDomNodeOrDie()).setText(""); return; } ((HtmlTextArea) getDomNodeOrDie()).setText(Context.toString(value)); }
public void sendKeys(CharSequence... value) { assertElementNotStale(); StringBuilder builder = new StringBuilder(); for (CharSequence seq : value) { builder.append(seq); } if (parent.isJavascriptEnabled() && !(element instanceof HtmlFileInput)) { try { element.type(builder.toString()); return; } catch (IOException e) { throw new WebDriverException(e); } } if (element instanceof HtmlInput) { String currentValue = getValue(); element.setAttribute("value", (currentValue == null ? "" : currentValue) + builder.toString()); } else if (element instanceof HtmlTextArea) { String currentValue = getValue(); ((HtmlTextArea) element).setText((currentValue == null ? "" : currentValue) + builder.toString()); } else { throw new UnsupportedOperationException("You may only set the value of elements that are input elements"); } }
((HtmlTextArea)input).setText(value); return;
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF); java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF); WebClient client = new WebClient(BrowserVersion.CHROME); client.getOptions().setJavaScriptEnabled(true); client.getOptions().setThrowExceptionOnScriptError(false); client.getOptions().setThrowExceptionOnFailingStatusCode(false); String url = "http://lsa.colorado.edu/cgi-bin/LSA-pairwise.html"; final HtmlPage page = client.getPage(url); HtmlForm htmlForm = page.getForms().get(0); HtmlTextArea txtA = htmlForm.getTextAreaByName("txt1"); txtA.setText("hello"); HtmlSubmitInput submitBt = htmlForm.getInputByValue("Submit Texts"); // change the form action attribute to the correct one htmlForm.setAttribute("action", "http://lsa.colorado.edu/cgi-bin/LSA-pairwise-x.html"); HtmlPage page2 = submitBt.click(); System.out.println(page2.asText());
((HtmlTextArea) element).setText( (currentValue == null ? "" : currentValue) + keysToSend.toString()); } else {
/** * Sets the text contained within the range. * @param text the text contained within the range */ public void jsxSet_text(final String text) { collapsed_ = false; final HtmlPage page = (HtmlPage) getWindow().getDomNodeOrDie(); final Range selection = page.getSelection(); // currently only working for text input and textarea if (selection.getStartContainer() == selection.getEndContainer()) { if (selection.getStartContainer() instanceof HtmlTextInput) { final HtmlTextInput input = (HtmlTextInput) selection.getStartContainer(); final String oldValue = input.getValueAttribute(); input.setValueAttribute(oldValue.substring(0, input.getSelectionStart()) + text + oldValue.substring(input.getSelectionEnd())); } else if (selection.getStartContainer() instanceof HtmlTextArea) { final HtmlTextArea input = (HtmlTextArea) selection.getStartContainer(); final String oldValue = input.getText(); input.setText(oldValue.substring(0, input.getSelectionStart()) + text + oldValue.substring(input.getSelectionEnd())); } } }
/** * Sets the text contained within the range. * @param text the text contained within the range */ public void jsxSet_text(final String text) { collapsed_ = false; final HtmlPage page = (HtmlPage) getWindow().getDomNodeOrDie(); final Range selection = page.getSelection(); // currently only working for text input and textarea if (selection.getStartContainer() == selection.getEndContainer()) { if (selection.getStartContainer() instanceof HtmlTextInput) { final HtmlTextInput input = (HtmlTextInput) selection.getStartContainer(); final String oldValue = input.getValueAttribute(); input.setValueAttribute(oldValue.substring(0, input.getSelectionStart()) + text + oldValue.substring(input.getSelectionEnd())); } else if (selection.getStartContainer() instanceof HtmlTextArea) { final HtmlTextArea input = (HtmlTextArea) selection.getStartContainer(); final String oldValue = input.getText(); input.setText(oldValue.substring(0, input.getSelectionStart()) + text + oldValue.substring(input.getSelectionEnd())); } } }
/** * Sets the text contained within the range. * @param text the text contained within the range */ public void jsxSet_text(final String text) { collapsed_ = false; final HtmlPage page = (HtmlPage) getWindow().getDomNodeOrDie(); final Range selection = page.getSelection(); // currently only working for text input and textarea if (selection.getStartContainer() == selection.getEndContainer()) { if (selection.getStartContainer() instanceof HtmlTextInput) { final HtmlTextInput input = (HtmlTextInput) selection.getStartContainer(); final String oldValue = input.getValueAttribute(); input.setValueAttribute(oldValue.substring(0, input.getSelectionStart()) + text + oldValue.substring(input.getSelectionEnd())); } else if (selection.getStartContainer() instanceof HtmlTextArea) { final HtmlTextArea input = (HtmlTextArea) selection.getStartContainer(); final String oldValue = input.getText(); input.setText(oldValue.substring(0, input.getSelectionStart()) + text + oldValue.substring(input.getSelectionEnd())); } } }
@Override public void clear() { assertElementNotStale(); if (element instanceof HtmlInput) { HtmlInput htmlInput = (HtmlInput) element; if (htmlInput.isReadOnly()) { throw new InvalidElementStateException("You may only edit editable elements"); } if (htmlInput.isDisabled()) { throw new InvalidElementStateException("You may only interact with enabled elements"); } htmlInput.setValueAttribute(""); } else if (element instanceof HtmlTextArea) { HtmlTextArea htmlTextArea = (HtmlTextArea) element; if (htmlTextArea.isReadOnly()) { throw new InvalidElementStateException("You may only edit editable elements"); } if (htmlTextArea.isDisabled()) { throw new InvalidElementStateException("You may only interact with enabled elements"); } htmlTextArea.setText(""); } else if (!element.getAttribute("contenteditable").equals(DomElement.ATTRIBUTE_NOT_DEFINED)) { element.setTextContent(""); } }