Q: Are you using Selenium IDE FireFox plug-in to record?
A: Yes. I have it record what I want to do, then I use the export function to put the Selenium commands into perl, then copy and paste into a text editor and remove the "_ok"s and place "sel->start();" in the code.
RE: Test::WWW::Selenium - Thanks I changed that, but my code doesn't seem to run how I want it to.
RE: Real website and login - The real website and my login is real in the code below.
RE: Else, elsif, \@ - Thanks, I changed that too but my code doesn't seem to run how I want it to.
- Go to www.cokezone.co.uk
- Login (and handle any pops if they happen
- Check the number of points in the account and put into a scalar variable $points
- Open a file handle <CODES> and read the codes into an array @codes
- Enter the codes into the website and check against the $points scalar variable to see if they were entered correctly - printing if the code was successful or not
- Carry on for each of codes in the array @codes
- Logout when done
Progress: I've only gotten as far as no. 2 in the Selenium IDE, and I can only get to no. 1 using the Selenium RC and Perl.
I'm pretty confident I can write a file handle and read it into an array and for each of the codes get Selenium to input them into the CokeZone website, however it's no use if I can't even automate a login that handles the popups!
Code I've written to try to login and handle the popups:
my $sel = WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*chrome",
browser_url => "http://www.cokezon
if ( $sel->is_text_present("Thanks for visiting!\n\nNow here's your ch
+ance to tell us what you think. This quick and easy survey will only
+take you a few minutes to fill out, and it'll help us to get more of
+the stuff you want to see into 'Coke Zone'.\n\nThanks for your help,\
+nThe 'Coke Zone' Team") == 1 )
if ( $sel->is_text_present("At the end of your visit on this website p
+lease take the time to complete an on-line survey, which will provide
+ us with feedback on the website. Please do not close this window.\n\
+nEnjoy your visit")
== 1 )
my $points = $sel->get_text("//div[\@id='header_links']/div/div/