#! /usr/bin/perl use strict; use warnings; use WWW::Selenium; my $sel = WWW::Selenium->new( host => "localhost", port => 4444, browser => "*chrome", browser_url => "http://www.cokezone.co.uk" ); $sel->start(); $sel->open("/home/index.jsp"); $sel->click("link=Log in"); $sel->wait_for_page_to_load("30000"); if ( $sel->is_text_present("Thanks for visiting!\n\nNow here's your chance 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 ) { $sel->select_window("entry"); $sel->close(); $sel->select_window("null"); } if ( $sel->is_text_present("At the end of your visit on this website please 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 ) { $sel->select_window("stealth"); $sel->close(); $sel->select_window("null"); } $sel->click("emailAddress"); $sel->type("emailAddress", "bogus\@fake.com"); $sel->type("password", "password"); $sel->click("remember"); $sel->click("subButton"); $sel->wait_for_page_to_load("30000"); my $points = $sel->get_text("//div[\@id='header_links']/div[1]/div[1]/h3"); print $points $sel->click("link=Log out"); exit 0;