
WebElements in Selenium WebDriver
WebElements in Selenium WebDriver
Selenium WebDriver WebElement methods are applicable to almost all DOM elements on a web page. Each WebElement is represented in Selenium via the WebElement interface – which is used by Selenium to interact with visible and invisible elements on the web page.
- sendKeys(javadang.CharSequence… keysToSend) – Use this method to simulate typing into an element, which may set its value.
- clear() – If this element is a text entry element, this will clear the value.
- click() – Click this element.
- getAttribute(java.lang.String name) – Get the value of the given attribute of the element.
- getCssValue(java.lang.String propertyName) – Get the value of a given CS.S property.
- getLocation() – Where on the page is the top left-hand corner of the rendered element?
- getSizeO – What is the width and height of the rendered element?
- getTagName() – Get the tag name of this element.
- getText() – Get the visible text
- isDisplayed() – Is this element displayed or not? This method avoids the problem of having to parse an element’s *style” attribute.
- isEnabled() – Is the element currently enabled or not? This will generally return true for everything but disabled input elements.
- isSelected() – Determine whether or not this element is selected or not.