MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / WebElement

Interface WebElement

java/src/org/openqa/selenium/WebElement.java:32–335  ·  view source on GitHub ↗

Represents an HTML element. Generally, all interesting operations to do with interacting with a page will be performed through this interface. All method calls will do a freshness check to ensure that the element reference is still valid. This essentially determines whether the element is still

Source from the content-addressed store, hash-verified

30 * future calls to this instance will fail.
31 */
32public interface WebElement extends SearchContext, TakesScreenshot {
33 /**
34 * Click this element. If this causes a new page to load, you should discard all references to
35 * this element and any further operations performed on this element will throw a
36 * StaleElementReferenceException.
37 *
38 * <p>Note that if click() is done by sending a native event (which is the default on most
39 * browsers/platforms) then the method will _not_ wait for the next page to load and the caller
40 * should verify that themselves.
41 *
42 * <p>There are some preconditions for an element to be clicked. The element must be visible, and
43 * it must have a height and width greater than 0.
44 *
45 * <p>See <a href="https://w3c.github.io/webdriver/#element-click">W3C WebDriver specification</a>
46 * for more details.
47 *
48 * @throws StaleElementReferenceException If the element no longer exists as initially defined
49 */
50 void click();
51
52 /**
53 * If this current element is a form, or an element within a form, then this will be submitted to
54 * the remote server. If this causes the current page to change, then this method will block until
55 * the new page is loaded.
56 *
57 * @throws NoSuchElementException If the given element is not within a form
58 */
59 void submit();
60
61 /**
62 * Use this method to simulate typing into an element, which may set its value.
63 *
64 * <p>See <a href="https://w3c.github.io/webdriver/#element-send-keys">W3C WebDriver
65 * specification</a> for more details.
66 *
67 * @param keysToSend character sequence to send to the element
68 * @throws IllegalArgumentException if keysToSend is null
69 */
70 void sendKeys(CharSequence... keysToSend);
71
72 /**
73 * If this element is a form entry element, this will reset its value.
74 *
75 * <p>See <a href="https://w3c.github.io/webdriver/#element-clear">W3C WebDriver specification</a>
76 * and <a href="https://html.spec.whatwg.org/#concept-form-reset-control">HTML specification</a>
77 * for more details.
78 */
79 void clear();
80
81 /**
82 * Get the tag name of this element. <b>Not</b> the value of the name attribute: will return
83 * <code>"input"</code> for the element <code>&lt;input name="foo" /&gt;</code>.
84 *
85 * <p>See <a href="https://w3c.github.io/webdriver/#get-element-tag-name">W3C WebDriver
86 * specification</a> for more details.
87 *
88 * @return The tag name of this element.
89 */

Implementers 2

RemoteWebElementjava/src/org/openqa/selenium/remote/Re
WrappedWebElementjava/test/org/openqa/selenium/WrappedW

Calls

no outgoing calls

Tested by

no test coverage detected