Terminating Selenium Browser sessions
Posted: Fri Sep 09, 2016 9:07 am
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:
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();