NAME
Selenium::Remote::WebElement - Representation of an HTML Element used by Selenium Remote Driver
DESCRIPTION
Selenium Webdriver represents all the HTML elements as WebElement. This module provides a mechanism to represent them as objects & perform various actions on the related elements. This module should not be instantiated directly by the end user. Selenium::Remote::Driver instantiates this module when required. Typically, the find_element method in Selenium::Remote::Driver returns this object on which various element related operations can be carried out.
FUNCTIONS
click
Description:
Click the element.
Usage:
$elem->click();
submit
Description:
Submit a FORM element. The submit command may also be applied to any element
that is a descendant of a FORM element.
Usage:
$elem->submit();
send_keys
Description:
Send a sequence of key strokes to an element.
Input: 1
Required:
{ARRAY | STRING} - Array of strings or a string.
Usage:
$elem->send_keys('abcd', 'efg');
$elem->send_keys('hijk');
is_selected
Description:
Determine if an OPTION element, or an INPUT element of type checkbox or
radiobutton is currently selected.
Output:
BOOLEAN - whether the element is selected
Usage:
$elem->is_selected();
set_selected
Description:
Select an OPTION element, or an INPUT element of type checkbox or radiobutton.
Usage:
$elem->set_selected();
Note: DEPRECATED -- use click instead
toggle
Description:
Toggle whether an OPTION element, or an INPUT element of type checkbox or
radiobutton is currently selected.
Output:
BOOLEAN - Whether the element is selected after toggling its state.
Usage:
$elem->toggle();
Note: DEPRECATED -- use click instead
is_enabled
Description:
Determine if an element is currently enabled.
Output:
BOOLEAN - Whether the element is enabled.
Usage:
$elem->is_enabled();
get_element_location
Description:
Determine an element's location on the page. The point (0, 0) refers to the
upper-left corner of the page.
Output:
HASH - The X and Y coordinates for the element on the page.
Usage:
$elem->get_element_location();
get_element_location_in_view
Description:
Determine an element's location on the screen once it has been scrolled
into view.
Note: This is considered an internal command and should only be used to
determine an element's location for correctly generating native events.
Output:
{x:number, y:number} The X and Y coordinates for the element on the page.
Usage:
$elem->get_element_location_in_view();
get_tag_name
Description:
Query for an element's tag name.
Output:
STRING - The element's tag name, as a lowercase string.
Usage:
$elem->get_tag_name();
clear
Description:
Clear a TEXTAREA or text INPUT element's value.
Usage:
$elem->clear();
get_attribute
Description:
Get the value of an element's attribute.
Input: 1
Required:
STRING - name of the attribute of the element
Output:
{STRING | NULL} The value of the attribute, or null if it is not set on the element.
Usage:
$elem->get_attribute('name');
get_value
Description:
Query for the value of an element, as determined by its value attribute.
Output:
{STRING | NULL} The element's value, or null if it doesn't have a value attribute.
Usage:
$elem->get_value();
is_displayed
Description:
Determine if an element is currently displayed.
Output:
BOOLEAN - Whether the element is displayed.
Usage:
$elem->is_displayed();
drag
Description:
Drag and drop an element. The distance to drag an element should be
specified relative to the upper-left corner of the page and it starts at 0,0
Input: 2
Required:
NUMBER - X axis distance in pixels
NUMBER - Y axis distance in pixels
Usage:
$elem->drag(216,158);
get_size
Description:
Determine an element's size in pixels. The size will be returned with width
and height properties.
Output:
HASH - The width and height of the element, in pixels.
Usage:
$elem->get_size();
get_text
Description:
Get the innerText of the element.
Output:
STRING - innerText of an element
Usage:
$elem->get_text();
get_css_attribute
Description:
Query the value of an element's computed CSS property. The CSS property to
query should be specified using the CSS property name, not the JavaScript
property name (e.g. background-color instead of backgroundColor).
Input: 1
Required:
STRING - name of the css-attribute
Output:
STRING - Value of the css attribute
Usage:
$elem->get_css_attribute('background-color');
hover
Description:
Move the mouse over an element.
Usage:
$elem->hover();
describe
Description:
Describe the identified element
Usage:
$elem->describe();
SEE ALSO
For more information about Selenium , visit the website at http://code.google.com/p/selenium/.
BUGS
The Selenium issue tracking system is available online at http://github.com/aivaturi/Selenium-Remote-Driver/issues.
CURRENT MAINTAINER
Gordon Child <gchild@gordonchild.com>
AUTHOR
Perl Bindings for Selenium Remote Driver by Aditya Ivaturi <ivaturi@gmail.com>
LICENSE
Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.