Friday, March 7, 2008

GetHtmlSource() acting differently in different locations of the app

I have a perl subroutine that i add to the exported selenium script to validate if there is a certain message (message1) appearing upon performing certain steps in the app.
I have the subroutine in testscript1.pl (for module1 in AUT) and in testscript2.pl (for module2 in AUT).
Testscript1.pl executes with the html source of the AUT being spit out, but testscript2.pl gives a modified html code as pasted below...


Subroutine added in both Scripts -
"
...
sub data_extract
{
my $text=0;
$text = $sel->get_html_source_ok();
print "$text\n";
if ($text =~ m/$_[0]/){
print "there is a validation error on page\n";
$sel->select_frame_ok("topframe");
$sel->click_ok("link=Logout");
$sel->stop;
exit; }
}
...
...
...
&data_extract("Validation Error");
...

Expecting - to see the html source of the AUT.
Actually see - the html content referencing selenium scripts all over.

Issue that its causing - in testscript1.pl, I am able to logout upon a 'Validation Error', but in testscript2.pl, I am not. I tried with get_body_text() too, but same result.

This is how I start selenium rc -
C:\selenium\selenium-remote-control-0.9.2\selenium-server-0.9.2>java -jar selenium-server.jar -inter
active -Dselenium.slowMode=500 -log selenium_perl.log -proxyInjectionMode



Have posted this issue in the Selenium Forum - lets see if someone can figure the issue out.

-V.

No comments: