By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

Unable to get web page element while running perl script with selenium RC server .

P: 16
Hi All,

I am facing a problem while running a perl script through selenium RC server .

I recorded oone log in test case with slenium IDE and run it after that with the ide only and it worked fine .

After I exported that test case as a perl script . I installed all the required modules (like Test::WWW::Selenium,Test::More,Test::Exception)by PPM GUI (As I am using active perl 5.10 on winxp).I run the Selenium Rc server and tried to execute my below code .
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use Time::HiRes qw(sleep);
  4. use Test::WWW::Selenium;
  5. use Test::More "no_plan";
  6. use Test::Exception;
  7.  
  8. my $sel = Test::WWW::Selenium->new( host => "localhost", 
  9.                                     port => 4444, 
  10.                                     browser => "*firefox", 
  11.                                     browser_url => "http://localhost:28080/" );
  12.  
  13. my $s = $sel->open_ok("/interop/index.jsp");
  14. print " \n Test Script \n ";
  15. print " \n \n my var $s \n \n";
  16. $sel->set_speed("1000");        # without this line, everything will error out.
  17. $sel->wait_for_page_to_load_ok("100000");
  18. sleep (50);
  19. $sel->type_ok("bpm.Logon.1.txtPassword", "password");
  20. $sel->click_ok("bpm.Logon.1.btnLogon");
  21.  
and after executing that code the broswer opens that url page and the status shows as "done". But In that opened page no UI elements are there like text box and buttons , It is a blank page .

The console result shows :
Expand|Select|Wrap|Line Numbers
  1. D:\selenium_sc_HSS\RC>perl pl3.pl
  2. ok 1 - open, http://localhost:19000/interop/index.jsp
  3.  
  4.  Test Script
  5.  
  6.  
  7.  my var 1
  8.  
  9. ok 2 - wait_for_page_to_load, 100000
  10. # Error requesting http://localhost:4444/selenium-server/driver/:
  11. # ERROR: Element bpm.Logon.1.txtPassword not found
  12. not ok 3 - type, bpm.Logon.1.txtPassword, password
  13. #   Failed test 'type, bpm.Logon.1.txtPassword, password'
  14. #   at pl3.pl line 27.
  15. # Error requesting http://localhost:4444/selenium-server/driver/:
  16. # ERROR: Element bpm.Logon.1.btnLogon not found
  17. not ok 4 - click, bpm.Logon.1.btnLogon
  18. #   Failed test 'click, bpm.Logon.1.btnLogon'
  19. #   at pl3.pl line 28.
  20. 1..4
  21. # Looks like you failed 2 tests of 4.
  22.  
Because of the page element text box with ID "bpm.Logon.1.txtPassword" is not loaded (As I mentioned it is coming as blank page) the script is throwing error as "Element bpm.Logon.1.btnLogon not found"

Can any one help me on this why the page is not getting loaded fully though the firefox browser status is showing "done" and the same test case is loading the page fully with selenium IDE .

Advance thanks for any input on this..!!
Oct 25 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.