We Recommend

Learning Perl Learning Perl
In this smooth, carefully paced course, a leading Perl trainer teaches you to program in the language that threatens to make C, sed, awk, and the Unix shell obsolete for many tasks. This book is the "official" guide for both formal (classroom) and informal learning. It is fully accessible to the novice programmer.


Posted By

noah on 09/15/07


Tagged

test commandline web environment work ui markup ux automation interaction selenium behavior qa selenium-rc


Versions (?)


Automated UI test with Selenium-RC, WWW::Selenium and Test::More


Published in: Perl 


In order for this to work, the Selenium-RC server must be running.

See also the tutorial at http://search.cpan.org/~mschwern/Test-Simple-0.71/lib/Test/Tutorial.pod

  1. use WWW::Selenium;
  2. use Test::More tests => 2; #update to reflect the number of tests to be run
  3.  
  4. my $sel = WWW::Selenium->new( host => "localhost",
  5. port => 4444,
  6. browser => "*iexplore", # *iehta has more cross-domain privileges than *iexplore
  7. browser_url => "http://mysite.com",
  8. );
  9. $sel->start();
  10. $sel->open("http://mysite.com/testpopup.html");
  11. diag("Check whether the popup is hidden.");
  12. my $canSeePopup = $sel->is_visible("modalWindow");
  13. ok ($canSeePopup == 0, "Popup is not visible.");
  14. diag("Check whether the magic is hidden.");
  15. ok(
  16. $sel->is_visible("modalWindowMagicLayer") == 0,
  17. "CSS magic is hidden... for now."
  18. );
  19. $sel->stop();;

Report this snippet 

You need to login to post a comment.