Terminating Selenium Browser sessions

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Terminating Selenium Browser sessions

Post by dlukinski »

Hello XI support

WE asked you earlier about Selenium scripts issues and kept looking further into them:
- aside from badly written scripts (stops somewhere in the middle), we do have case (most of them), where scripts completes, but does not close the browser.

Eventually number of browsers overfills memory (uses all of it), which terminates selenium standalone server process.

How to deal and what is the proven way of terminating Firefox browsing sesssions with CPAN Perl commands? This was tried with 3 different Selenum servers (following your manual), always producing same results. You must have others having this problem too..

We tried replacing stop method with close and/or quit, but no luck. Browser still remains open upon completion of the script:

Code: Select all

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.x.x.x",
                                    port => 4444,
                                    browser => "*firefox",
                                    browser_url => "http://mydomain.konecranes.com/" );

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

elsif ( !  $sel->type_ok("id=page_x002e_components_x002e_slingshot-login_x0023_default-username", "nagximon") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( !  $sel->type_ok("id=page_x002e_components_x002e_slingshot-login_x0023_default-password", "mypasswd") ) {print "Location: " . $sel->get_location() . "\n";}

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

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->type_ok("css=input.alf-search-box-text", "53202206") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->pause(5000) ) {}
elsif ( ! $sel->key_press_native("10") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->click_ok("//div[\@id='search-result-table']/div/table/tbody/tr[4]/td[5]/a[2]/span") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->click_ok("id=HEADER_USER_MENU_POPUP_text") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->pause(5000) ) {}
elsif ( ! $sel->click_ok("id=HEADER_USER_MENU_LOGOUT_text") ) {print "Location: " . $sel->get_location() . "\n";}

elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( !$time->endTime("ALL") ) { }

else { $time->getTimes(); }
$sel->quit();
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Terminating Selenium Browser sessions

Post by tmcdonald »

I need to ask that this question be posted on a Selenium forum. Our documentation covers how to run a Selenium test case in Nagios, and shows a basic example, but going into anything beyond that is getting out of scope as it doesn't really deal with Nagios at that point. I wasn't able to find reports of others having this same issue - honestly you are just about the only person asking Selenium questions lately :)

While we are always happy to help with the Nagios side of things, this is something that the Selenium community would be better suited toward.
Former Nagios employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Terminating Selenium Browser sessions

Post by dlukinski »

tmcdonald wrote:I need to ask that this question be posted on a Selenium forum. Our documentation covers how to run a Selenium test case in Nagios, and shows a basic example, but going into anything beyond that is getting out of scope as it doesn't really deal with Nagios at that point. I wasn't able to find reports of others having this same issue - honestly you are just about the only person asking Selenium questions lately :)

While we are always happy to help with the Nagios side of things, this is something that the Selenium community would be better suited toward.
Alright, please close this support request

Thank you
Locked