Good morning, I have begun the task of automating functional tests for some of our web servers. I have had some success using Selenium IDE in Firefox to capture input sequences, exporting them to Perl scripts, then using the Se remote control server to execute them. But I have run into one minor problem.
A basic test is to verify the error message returned when an invalid password is entered. This test script is shown below. I can run this as a simple test, or it can be part of a suite. The command line to manually run the suite is normally: perl -MTest::Harness -e "@ARGV= map glob, @ARGV \ if $^O =~ /^MSWin/; runtests @ARGV;" test/*.pl Unfortunately, yes this is running on a WinXP system. My problem is that we have multiple virtual hosts on that server, and I need to select a specific host for each run. So when I run the harness I need some way to pass the "tst12.dev" portion of the URL into each of the test scripts. I can't see any way with Test::Harness or Test::More to do this. If I can, then I have other parameters that need to be passed in as well. Any suggestions? Bob McConnell ------8<-------------------------------------------- # Check for invalid password use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More "no_plan"; # currently 9 tests use Test::Exception; # The SeRC server must already be running in another process. my $sel = Test::WWW::Selenium->new( host => "localhost", port => 4444, browser => "*chrome", browser_url => "http://tst12.dev.managemyid.com/" ); $sel->open_ok("http://tst12.dev.managemyid.com/"); $sel->set_speed("1000"); # without this line, everything will error out. $sel->wait_for_page_to_load_ok("10000"); $sel->type_ok("LoginID", "devmmi...@tpsmail.dev"); $sel->type_ok("LoginPWD", "password"); $sel->click_ok("LoginSubmit"); $sel->wait_for_page_to_load_ok("10000"); like($sel->get_title(), qr/ManageMyID.com - Login/, "Login failed"); cmp_ok ($sel->get_text("css=div[class=Error]"), "=~", "Invalid Email Address and / or Password for", "Correct error message"); ------8<-------------------------------------------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/