Method | Example | Purpose |
clear() | this.driver.findElement({id: 'submit'}).clear(); | Clears all of the contents if the element is a text entity. |
click() | this.driver.findElement({id: 'submit'}).click(); | Simulates a mouse click on the element. |
getAttribute() | this.driver.findElement({id: 'submit'}).getAttribute('name'); | Returns the value associated with the provided attribute name (if present) or null (if not present). |
getTagName() | this.driver.findElement({id: 'submit'}).getTagName(); | Returns the tag name for this element. |
getText() | this.driver.findElement({id: 'submit'}).getText(); | Returns the visible text contained within this element (including subelements) if not hidden via CSS. |
getValue() | this.driver.findElement({id: 'submit'}).getValue(); | Gets the value of the element's “value” attribute. |
isEnabled() | this.driver.findElement({id: 'submit'}).isEnabled(); | Returns true for input elements that are currently enabled; otherwise false. |
isSelected() | this.driver.findElement({id: 'submit'}).isSelected(); | Returns true if the element (radio buttons, options within a select, and checkboxes) is currently selected; otherwise false. |
sendKeys(CharSequence… keysToSend) | this.driver.findElement({id: 'submit'}).sendKeys(this.webdriver.Key.ENTER); | Simulates typing into an element. |
setSelected() | this.driver.findElement({id: 'submit'}).setSelected(); | Select an element (radio buttons, options within a select, and checkboxes). |
submit() | {id: 'submit'}).submit(); | Submits the same block if the element is a form (or contained within a form). Blocks until new page is loaded. |
toggle() | this.driver.findElement({id: 'submit'}).toggle(); | Toggles the state of a checkbox element. |
Cheatographer
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets