Test::WWW::Selenium::More::Manual::BestPractices
Following these guidelines will make your life easier when writing Selenium tests. They are listed in order of importance.
Sometimes people use pause() or sleep() because wait_for_page_to_load_ok() doesn't work for them. The reason it doesn't work is page components are loading via JavaScript and wait_for_page_to_load_ok() ignores anything JavaScript related.
However using these methods will make your tests take a long time and will cause hard to reproduce intermittent failures and generally drive you crazy.
If your page uses jQuery, use jquery_wait_for_page_to_load_ok().
If your page doesn't use jQuery you can use wait_for_text_present_ok() in most cases.
CSS can't choose the nth thing in a list or table. XPATH can. For the sake of consistency you may want to stay with XPATH.
Most methods allow you to pass along a comment. The comment shows up in your TAP output.
For example. Sometimes when using XPATH, you should add a comment to the test output. You can do that like this:
$selenium->click_ok('//table/tbody/tr[3]/td/input[name=foo]', "click 3rd checkbox")
This works like Test::More::note().
Eric Johnson <kablamo at iijo dot nospamthanks dot org>
This software is copyright (c) 2012 by Eric Johnson.
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 Test::WWW::Selenium::More, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::WWW::Selenium::More
CPAN shell
perl -MCPAN -e shell install Test::WWW::Selenium::More
For more information on module installation, please visit the detailed CPAN module installation guide.