Java Code Examples for com.gargoylesoftware.htmlunit.html.HtmlInput#getValueAttribute()
The following examples show how to use
com.gargoylesoftware.htmlunit.html.HtmlInput#getValueAttribute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebAssert.java From htmlunit with Apache License 2.0 | 5 votes |
/** * Verifies that the input element with the specified name on the specified page contains the * specified value. * * @param page the page to check * @param name the name of the input element to check * @param value the value to check for */ public static void assertInputContainsValue(final HtmlPage page, final String name, final String value) { final String xpath = "//input[@name='" + name + "']"; final List<?> list = page.getByXPath(xpath); if (list.isEmpty()) { throw new AssertionError("Unable to find an input element named '" + name + "'."); } final HtmlInput input = (HtmlInput) list.get(0); final String s = input.getValueAttribute(); if (!s.equals(value)) { throw new AssertionError("The input element named '" + name + "' contains the value '" + s + "', not the expected value '" + value + "'."); } }
Example 2
Source File: WebAssert.java From htmlunit with Apache License 2.0 | 5 votes |
/** * Verifies that the input element with the specified name on the specified page does not * contain the specified value. * * @param page the page to check * @param name the name of the input element to check * @param value the value to check for */ public static void assertInputDoesNotContainValue(final HtmlPage page, final String name, final String value) { final String xpath = "//input[@name='" + name + "']"; final List<?> list = page.getByXPath(xpath); if (list.isEmpty()) { throw new AssertionError("Unable to find an input element named '" + name + "'."); } final HtmlInput input = (HtmlInput) list.get(0); final String s = input.getValueAttribute(); if (s.equals(value)) { throw new AssertionError("The input element named '" + name + "' contains the value '" + s + "', not the expected value '" + value + "'."); } }
Example 3
Source File: WebAssert.java From HtmlUnit-Android with Apache License 2.0 | 5 votes |
/** * Verifies that the input element with the specified name on the specified page contains the * specified value. * * @param page the page to check * @param name the name of the input element to check * @param value the value to check for */ public static void assertInputContainsValue(final HtmlPage page, final String name, final String value) { final String xpath = "//input[@name='" + name + "']"; final List<?> list = page.getByXPath(xpath); if (list.isEmpty()) { throw new AssertionError("Unable to find an input element named '" + name + "'."); } final HtmlInput input = (HtmlInput) list.get(0); final String s = input.getValueAttribute(); if (!s.equals(value)) { throw new AssertionError("The input element named '" + name + "' contains the value '" + s + "', not the expected value '" + value + "'."); } }
Example 4
Source File: WebAssert.java From HtmlUnit-Android with Apache License 2.0 | 5 votes |
/** * Verifies that the input element with the specified name on the specified page does not * contain the specified value. * * @param page the page to check * @param name the name of the input element to check * @param value the value to check for */ public static void assertInputDoesNotContainValue(final HtmlPage page, final String name, final String value) { final String xpath = "//input[@name='" + name + "']"; final List<?> list = page.getByXPath(xpath); if (list.isEmpty()) { throw new AssertionError("Unable to find an input element named '" + name + "'."); } final HtmlInput input = (HtmlInput) list.get(0); final String s = input.getValueAttribute(); if (s.equals(value)) { throw new AssertionError("The input element named '" + name + "' contains the value '" + s + "', not the expected value '" + value + "'."); } }