WebDriver.Element
This module handles WebDriver calls directed at specific DOM elements.
They all take an WebDriver.Element struct as the first argument. The WebDriver.Element struct is supposed to be an opaque data type and is not meant to be manipulated. It contains the internal id of the element used by the webdriver client and a the session name.
Elements are associated with a particular session and have no meaning outside that WedDriver session.
Accessing an element that does not exist on the page will return a response
of { :stale_element_reference, response }
All the command functions will return {:ok, response}
or
{error, response}
where error
is one of those listed in
WebDriver.Error.
Summary
attribute(element, attribute_name) | Returns the value of the given element’s attribute |
clear(element) | Clears the specified form field or textarea element |
click(element) | Click on the specified element |
css(element, property_name) | Get the computed value of an element’s CSS property. https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/css/:propertyName |
displayed?(element) | Returns a boolean denoting if the element is currently visible |
enabled?(element) | Returns a boolean denoting if the element is enabled or not |
equals?(element, other_element) | Determine if two element ids refer to the same DOM element |
location(element) | Returns the current location of the specified element in pixels from the top left corner |
location_in_view(element) | Determine an element’s location once it has been scrolled into view |
name(element) | Get the name of the specified element |
selected?(element) | Returns a boolean denoting if the element is selected or not. Returns {:element_not_selectable, response} if it is not able to be selected |
size(element) | Returns size in pixels of the specified element |
submit(element) | Submit a FORM element. May be applied to any descendent of a FORM element |
text(element) | Retreives the visible text of the element. Returns a string |
value(element, value) | Send a list of keystrokes to the specified element |
Functions
Returns the value of the given element’s attribute.
Clears the specified form field or textarea element.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/clear
Click on the specified element.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/click
Get the computed value of an element’s CSS property. https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/css/:propertyName
Returns a string.
Returns a boolean denoting if the element is currently visible.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/displayed
Returns a boolean denoting if the element is enabled or not.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/enabled
Determine if two element ids refer to the same DOM element.
Returns the current location of the specified element in pixels from the top left corner.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/location
Returns %{x: x, y: y}
Determine an element’s location once it has been scrolled into view.
Returns %{x: x, y: y}
Get the name of the specified element.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/name
Returns a boolean denoting if the element is selected or not. Returns {:element_not_selectable, response} if it is not able to be selected.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/selected
Returns size in pixels of the specified element.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/size
Returns %{width: w, height: h}
Submit a FORM element. May be applied to any descendent of a FORM element.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/submit
Retreives the visible text of the element. Returns a string.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/text
Send a list of keystrokes to the specified element.
https://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/value
Parameters: %{value: String}