Re: How to run/execute PERL script using selenium RC ?

440 views
Skip to first unread message

David

unread,
Jun 14, 2012, 8:45:52 PM6/14/12
to seleniu...@googlegroups.com
Well, does the test run successfully when you just run it from the IDE instead of the Perl script with Selenium Server. Could be timing related issue or your website/app has since changed causing element not found in test. Ideally if it fails in the script, it should also fail in the IDE.

On Thursday, June 14, 2012 11:08:47 AM UTC-7, Jackie wrote:
HI friends,
                I'm using selenium IDE to record some actions & replay the same test case. I'm not doing any test suite for this. Is it mandatory to do a test suite for this ?
I exported the same test case in PERL & saved it as 'new.pl' . I've selenium standalone server & Active PERL for this.  In the cmd prompt i executed the script as perl new.pl but i'm getting
error at the middle of the test case which says as element not found while the selenium server running at the other end.
 
                Am i following the right procedure ? If not, please let me know the procedure. I'm very new to the Selenium. Don't think my doubt as silly,please.I need your help.
         

Jackie

unread,
Jun 15, 2012, 12:20:30 AM6/15/12
to seleniu...@googlegroups.com
@ David : Yup, it works perfectly in Selenium IDE but not in Selenium RC. Am i wrong in following procedure ? Please let me know if any modifications have to be done.

David

unread,
Jun 15, 2012, 2:34:30 PM6/15/12
to seleniu...@googlegroups.com
It might help if you post the exact error you receive when running Perl script.

And if you are able to use other languages (Python, Java, etc.) it might help to export IDE test in those formats and run test to see if it also fails. Just a good way to narrow down whether issue is with Selenium server execution of code, or whether it is with the Perl language bindings.

Another thing you could do is add wait period in the Perl script for element to show up if the script fails from running test too fast and thus didn't find element because of that. But that requires you to actually know some Perl to tweak the script to work correctly. The easy hack for the time being is to add some sleep(seconds) command to slow down the script if it was running too fast, to see if that helps. But the real fix if that is the case would be to poll if element exists on page and if not keep waiting until a given timeout for synchronization of test rather than a bunch of sleep commands.

dave

unread,
Jun 15, 2012, 8:35:46 PM6/15/12
to seleniu...@googlegroups.com
Slightly off-topic: Don't use "wait" commands b/c you never know how long whatever you're "waiting on" will take (if it takes longer than expected). Also, on the flipside, if you wait too long, you are inefficiently waiting (i.e. using valuable processor resources).
Overall, it's not good practice. Instead, use threading or waitFor() type logic. Or while loops (also discouraged but better than wait-type commands)

As far as your original question goes, I'd have to agree with the responses. Please post some code. It will help with diagnosis. I'd be glad to try to help too.
Reply all
Reply to author
Forward
0 new messages