Selenium WebElement Interface

All the operations to do with the interacting with the page will be preformed through this interface.
All method calls will do a freshness check to ensure that the element reference is still valid.This essentially determines whether or not the element is still attached to the DOM. If this test fails, then an StaleElementReferenceException is thrown, and all future calls to this instance will fail.

Methods available in the WebElement Interface are

void click() : This method will click on the element.

void submit() : If this current element is a form, or an element within a form, then this will be submitted to the remote server.

void sendKeys(CharSequence… keysToSend) : Use this method to simulate typing into an element, which may set its value.

void clear() : If this element is a text entry element, this will clear the value. Has no effect on other elements. Text entry elements are INPUT and TEXTAREA elements.

String getTagName() : Get the tag name of this element. Not the value of the name attribute: will return "input" for the element <input name="foo" />.

String getAttribute(String name) : Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.

boolean isSelected() : Determine whether or not this element is selected or not. This operation only applies to input This operation only applies to input elements such as checkboxes, options in a select and radio buttons.

boolean isEnabled() : Is the element currently enabled or not? This will generally return true for everything but disabled input elements.

String getText() : Get the visible (i.e. not hidden by CSS) text of this element, including sub-elements

boolean isDisplayed() : returns Whether or not the element is displayed.

String getCssValue(String propertyName) : returns The current, computed value of the property.

Design a site like this with WordPress.com
Get started