Selenium script issue.

This board serves as an open discussion and support collaboration point for Nagios XI. NOTE: Nagios XI customers should use the Customer Support forum to obtain expedited support.

Selenium script issue.

Postby njain213 » Fri May 06, 2016 3:47 pm

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
njain213
 
Posts: 83
Joined: Thu Jul 16, 2015 5:11 am

Re: Selenium script issue.

Postby rkennedy » Mon May 09, 2016 10:38 am

What is the output of nmap 10.72.76.43?
Former Nagios Employee
rkennedy
 
Posts: 6581
Joined: Mon Oct 05, 2015 11:45 am

Re: Selenium script issue.

Postby njain213 » Wed May 11, 2016 1:28 am

[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
njain213
 
Posts: 83
Joined: Thu Jul 16, 2015 5:11 am

Re: Selenium script issue.

Postby ssax » Wed May 11, 2016 10:06 am

What version of java is installed on the selenium server? What distro/version is the OS?


Thank you
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 4384
Joined: Wed Feb 11, 2015 12:54 pm

Re: Selenium script issue.

Postby njain213 » Mon May 16, 2016 5:59 am

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)
njain213
 
Posts: 83
Joined: Thu Jul 16, 2015 5:11 am

Re: Selenium script issue.

Postby njain213 » Mon May 16, 2016 7:24 am

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.
njain213
 
Posts: 83
Joined: Thu Jul 16, 2015 5:11 am

Re: Selenium script issue.

Postby hsmith » Mon May 16, 2016 5:03 pm

Can you post your selenium script with any sensitive information edited out?
Former Nagios Employee.
me.
User avatar
hsmith
Agent Smith
 
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1

Re: Selenium script issue.

Postby njain213 » Tue May 17, 2016 3:43 am

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)
Last edited by tmcdonald on Tue May 17, 2016 3:56 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
njain213
 
Posts: 83
Joined: Thu Jul 16, 2015 5:11 am

Re: Selenium script issue.

Postby hsmith » Tue May 17, 2016 4:00 pm

What OS is the host located at 10.72.76.43 running?
Former Nagios Employee.
me.
User avatar
hsmith
Agent Smith
 
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1

Re: Selenium script issue.

Postby ssax » Tue May 17, 2016 4:04 pm

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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 4384
Joined: Wed Feb 11, 2015 12:54 pm

Next

Return to Nagios XI

Who is online

Users browsing this forum: MSN [Bot] and 17 guests