Page 1 of 4

Selenium script issue.

Posted: Fri May 06, 2016 3:47 pm
by njain213
Hi Team,

I have recorded all that I want to monitor but when executing command " perl <script name>", sometime I am getting below errors.

ok 5 - click, id=sub
ok 6 - wait_for_page_to_load, 120000
# Error requesting http://10.72.76.43:4444/selenium-server/driver/:
# ERROR: Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/02_selenium_ ... le-windows for potential workarounds.
not ok 7 - select_window, name=Composite_HEC3AAF7FABE71671AE8EF96F0E3675D5
# Failed test 'select_window, name=Composite_HEC3AAF7FABE71671AE8EF96F0E3675D5

Could you please help me out as half script is running and half is not. But sometimes full script runs.

Thanks
Naman

Re: Selenium script issue.

Posted: Mon May 09, 2016 10:38 am
by rkennedy
What is the output of nmap 10.72.76.43?

Re: Selenium script issue.

Posted: Wed May 11, 2016 1:28 am
by njain213
[root@centos65 ~]# nmap 10.72.76.43

Starting Nmap 6.47 ( http://nmap.org ) at 2016-05-11 11:54 IST
Nmap scan report for 10.72.76.43
Host is up (0.00018s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
4444/tcp open krb524
MAC Address: 08:00:27:74:9E:45 (Cadmus Computer Systems)

Nmap done: 1 IP address (1 host up) scanned in 0.26 seconds

Re: Selenium script issue.

Posted: Wed May 11, 2016 10:06 am
by ssax
What version of java is installed on the selenium server? What distro/version is the OS?


Thank you

Re: Selenium script issue.

Posted: Mon May 16, 2016 5:59 am
by njain213
java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Re: Selenium script issue.

Posted: Mon May 16, 2016 7:24 am
by njain213
Again I am getting same issue for new script that recorded successfully.

[root@centos65 libexec]# perl imrsec
ok 1 - set_timeout, 120000
ok 2 - open, /worksitemp/index.jsp
ok 3 - type, name=Password, <login password>
ok 4 - click, id=login
ok 5 - wait_for_page_to_load, 120000
# Error requesting http://10.72.76.43:4444/selenium-server/driver/:
# ERROR: Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/02_selenium_ ... le-windows for potential workarounds.
not ok 6 - select_window, name=wsmpTop
# Failed test 'select_window, name=wsmpTop'
# at imrsec line 19.
Location: https://imrsec.xchanging.com/worksitemp ... e=homePage
1..6
# Looks like you failed 1 test of 6.

Re: Selenium script issue.

Posted: Mon May 16, 2016 5:03 pm
by hsmith
Can you post your selenium script with any sensitive information edited out?

Re: Selenium script issue.

Posted: Tue May 17, 2016 3:43 am
by njain213

Code: Select all

[root@centos65 libexec]# cat imrsec 
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
use TimePerf2;

my $time= TimePerf2->new(60,90,120);


my $sel = Test::WWW::Selenium->new( host => "10.72.76.43", 
                                    port => 4444, 
                                    browser => "*firefox", 
                                    browser_url => "<URL>/" );

$time->startTime("ALL");
$sel->set_timeout_ok("120000");
if ( !  $sel->open_ok("/worksitemp/index.jsp") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->set_speed("1500") ) { }

elsif ( !  $sel->type_ok("name=UserId", "<user id>") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->type_ok("name=Password", "<login pass>") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->click_ok("id=login") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {} 
elsif ( !  $sel->select_window_ok("name=wsmpTop") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->type_ok("name=umrPolicy", "B0001") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->select_window_ok("name=wsmpTop") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->click_ok("id=searchFormPolicyFirefox") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {} 
elsif ( !  $sel->select_window_ok("name=wsmpTop") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->click_ok("link=B0001 TEST 1") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {} 
elsif ( !  $sel->select_window_ok("name=wsmpTop") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->click_ok("link=Log Off - <user id>") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->click_ok("id=Cancel") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {} 
elsif ( !$time->endTime("ALL") ) { }

else { $time->getTimes(); }
$sel->stop();


root@centos65 libexec]# perl imrsec 
ok 1 - set_timeout, 120000
ok 2 - open, /worksitemp/index.jsp
ok 3 - type, name=UserId, <username>
ok 4 - type, name=Password, <login pass>
ok 5 - click, id=login
ok 6 - wait_for_page_to_load, 120000
# Error requesting http://10.72.76.43:4444/selenium-server/driver/:
# ERROR: Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/02_selenium_ide.html#alerts-popups-and-multiple-windows for potential workarounds.
not ok 7 - select_window, name=wsmpTop
#   Failed test 'select_window, name=wsmpTop'
#   at imrsec line 19.
Location: <URL>/dispatch?operation=zoom&datasource=homePage
1..7
# Looks like you failed 1 test of 7.

I have also tried to run above script after changing my java version but same issue persists.

Code: Select all

java -version
java version "1.6.0_39"
OpenJDK Runtime Environment (IcedTea6 1.13.11) (rhel-1.13.11.0.el6_7-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

Re: Selenium script issue.

Posted: Tue May 17, 2016 4:00 pm
by hsmith
What OS is the host located at 10.72.76.43 running?

Re: Selenium script issue.

Posted: Tue May 17, 2016 4:04 pm
by ssax
Taken from the IDE:
If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages like the following for each window as it is opened:

debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"

In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example). (This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using an empty (blank) url, like this: openWindow("", "myFunnyWindow").
Are you seeing any of those debug messages in your Selenium server log that may be helpful?