This will create a new Test::WebDriver object, which subclasses Selenium::Remote::Driver. This subclass provides useful testing functions. It is modeled on Test::WWW::Selenium.
Environment vars can be used to specify options to pass to Selenium::Remote::Driver. ENV vars are prefixed with TWD_.
TWD_
Set the Selenium server address with $TWD_HOST and $TWD_PORT.
$TWD_HOST
$TWD_PORT
Pick which browser is used using the $TWD_BROWSER, $TWD_VERSION, $TWD_PLATFORM, $TWD_JAVASCRIPT, $TWD_EXTRA_CAPABILITIES.
$TWD_BROWSER
$TWD_VERSION
$TWD_PLATFORM
$TWD_JAVASCRIPT
$TWD_EXTRA_CAPABILITIES
See Selenium::Driver::Remote for the meanings of these options.
Returns true if a Selenium server is running. The host and port parameters are optional, and default to localhost:4444.
localhost:4444
Environment vars TWD_HOST and TWD_PORT can also be used to determine the server to check.
TWD_HOST
TWD_PORT
Below here are some methods that make things less easier or less wordy.
Get the text of a particular element. Wrapper around find_element()
Get the current text for the whole body.
Get the current URL.
Get the path part of the current browser location.
For Best Practice - I recommend subclassing Test::WebDriver for your application, and then refactoring common or app specific methods into MyApp::WebDriver so that your test files do not have much duplication. As your app changes, you can update MyApp::WebDriver rather than all the individual test files.
Created by: Luke Closs <lukec@cpan.org>, but inspired by Test::WWW::Selenium and it's authors.
This work was sponsored by Prime Radiant, Inc.
Copyright (c) 2012 Prime Radiant, Inc.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::WebDriver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::WebDriver
CPAN shell
perl -MCPAN -e shell install Test::WebDriver
For more information on module installation, please visit the detailed CPAN module installation guide.