Selenium::Element - Unified way of interacting with Selenium & WebDriver elements, with a focus on inputs.
Smooths out the interface between WWW::Selenium and Selenium::Remote::Driver elements. Also creates a unified set/get interface for all inputs.
Create a new Selenium::Element. You should never have to use/override this except in the most extreme of circumstances. Use getElement/getElements instead.
INPUTS:
ELEMENT (MIXED) - Either the WWW::Selenium locator string or a Selenium::Remote::WebElement, depending on your driver
DRIVER (MIXED) - Either a WWW::Selenium element or false, depending on your driver (the WebElement has the driver in the latter case)
SELECTOR (ARRAYREF[string]) - Arrayref of the form [selector,selectortype]
OUTPUT:
new Selenium::Element
Returns the tag name of the Element object.
Returns the type of the Element object if it is an input tag.
Returns whether the element is an input.
Returns whether the element is an input with type 'text' or 'password' or a textarea.
Returns whether the element is a select.
Returns whether the element is a select with the 'multiple' attribute.
Returns whether the element is a radio button.
Returns whether the element is a checkbox.
Returns whether the element is an input of the type 'submit'.
Returns whether the element is an input of the type 'file'.
Returns whether the element is an option.
Returns whether the element is an input of type 'hidden'.
Returns whether the element is a disabled input.
Returns a list containing Selenium::Element objects that are child options, if this object is a select.
Returns whether this element has a child option with the provided name, provided this object is a select.
INPUT: OPTION (STRING) - the name of the desired option
OUTPUT: BOOLEAN - whether this object has said option as a child
Returns whether the element is selected.
Returns the current value of the element.
MIXED - Depends on the type of element. Boolean for checkboxes, options and radiobuttons Arrayrefs of option names for multi-selects Strings for single selects, text/hidden inputs and non-inputs like paragraphs, table cells, etc.
Returns the element's id.
Returns the element's name.
Clear a text input.
Set the value of the input to the provided value, and execute the provided callback if provided. The callback will be provided with the caller and the selenium driver as arguments.
INPUT:
VALUE (MIXED) - STRING, BOOLEAN or ARRAYREF, depending on the type of element you are attempting to set. Strings are for textinputs, hiddens or non-multi selects, Booleans for radiobuttons, checkboxes and options, and Arrayrefs of strings for multiselects. Selects take the name of the option as arguments.
CALLBACK (CODE) [optional] - some anonymous function
MIXED - whether the set succeeded, or whatever your callback feels like returning, supposing you provided one.
Randomizes the input, depending on the type of element. Useful for fuzzing.
HASH: Options appropraite to the relevant Data::Random method.
MIXED - Random value that has been set into the field, or false on failure.
Execute an arbitrary Javascript string and return the output. Handy in callbacks that wait for JS events.
JS (STRING) - any valid javascript string
MIXED - depends on your javascript's output.
Click the element.
Submit the element, supposing it's a form
CALLBACK (CODE) [optional] - anonymous function
OUPUT:
MIXED - Whether the action succeeded or whatever your callback returns, supposing it was provided.
WWW::Selenium
Selenium::Remote::Driver
George S. Baugh <teodesian@cpan.org>
cPanel, Inc. graciously funded the initial work on this Module.
This software is copyright (c) 2014 by George S. Baugh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Selenium::PageObject, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Selenium::PageObject
CPAN shell
perl -MCPAN -e shell install Selenium::PageObject
For more information on module installation, please visit the detailed CPAN module installation guide.