Share
Go down
Divya J
Posts : 2
Join date : 2011-02-28

Avoid browser closing on selenium RC shutdown

on Mon Feb 28, 2011 6:05 pm
Hi All,

I am using java/Selenium RC for testing. I start the selenium server programatically and i find that whenever an exception occurs or when the execution of a test case is completed, the browser gets closed. What can be done to have the browser opened?

I googled to find there is a property auto_stop. IT is mentioned that if it is by default set to true, and if it is made as false we can avoid the browser closing. But am not able to figure out where and how i can alter this property. Can someone plz let me know on this?
avatar
selenium.testing07
Regular Participant
Regular Participant
Posts : 26
Join date : 2010-11-20

Re: Avoid browser closing on selenium RC shutdown

on Mon Feb 28, 2011 6:21 pm
In your project code you have a command like:
selenium.Stop();

comment this, and hopefully browser will remains open.

bye!
Divya J
Posts : 2
Join date : 2011-02-28

Re: Avoid browser closing on selenium RC shutdown

on Mon Feb 28, 2011 6:44 pm
I dont have any such line to stop the selenium server.
avatar
selenium.testing07
Regular Participant
Regular Participant
Posts : 26
Join date : 2010-11-20

Re: Avoid browser closing on selenium RC shutdown

on Mon Feb 28, 2011 6:47 pm
This is in C# here:

public void TeardownTest()
{
try
{
selenium.Stop();




Can you copy your java code here?
will try to let you know.
it must be there like that.
Nicolae
Posts : 3
Join date : 2011-03-09

Re: Avoid browser closing on selenium RC shutdown

on Wed Mar 09, 2011 6:33 pm
Sorry to interrupt the conversation, but is there a way to avoid this behaviour as well for Selenium perl test cases?
avatar
selenium.testing07
Regular Participant
Regular Participant
Posts : 26
Join date : 2010-11-20

Re: Avoid browser closing on selenium RC shutdown

on Wed Mar 09, 2011 6:48 pm
Its ok Nicolae!

You need to remove or comment this command in your perl code:

$sel->stop();


Let me know, if not work.


Thanks
Nicolae
Posts : 3
Join date : 2011-03-09

Re: Avoid browser closing on selenium RC shutdown

on Wed Mar 09, 2011 7:13 pm
I dont' have that line in my test case code, where do you mean I have to remove it from?
Thanks in advance!
avatar
selenium.testing07
Regular Participant
Regular Participant
Posts : 26
Join date : 2010-11-20

Re: Avoid browser closing on selenium RC shutdown

on Wed Mar 09, 2011 7:22 pm
if its not there.....then it should not stop automatically.

Can you copy your whole code here?


Last edited by selenium.testing07 on Wed Mar 09, 2011 7:23 pm; edited 1 time in total (Reason for editing : other)
Nicolae
Posts : 3
Join date : 2011-03-09

Re: Avoid browser closing on selenium RC shutdown

on Wed Mar 09, 2011 7:38 pm
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;

my $sel = Test::WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*chrome",
browser_url => "http://wpre1" );




#genera DNI
my $range = 90000000;
my $minimum = 9999999;
my $random = int(rand($range)) + $minimum;
sub LetraDNI {
my $numbers = shift;
return substr( 'TRWAGMYFPDXBNJZSQVHLCKE', $numbers % 23, 1);
}
my $letter = LetraDNI ($random);
my $DNI = $random.$letter;
#FIN GENERAR DNI

my $password = "password";
#AƱade DNI al email
my $email = "name.lastname+" . $DNI . '@mail.es';
my $nombre = "Nombre";
my $apellido = "Apellido";
my $calle = "Palma";
my $CP = "28288";
my $poblacion = "Madrid";
my $telefono = "666999666";



$sel->open_ok("registrationform.do");
$sel->click_ok("//input[\@name='idtype' and \@value='1']");
$sel->type_ok("id", $DNI);
$sel->type_ok("identifier=registration-login-table-password", $password);
$sel->type_ok("confirmationpassword", $password);
$sel->type_ok("identifier=registration-login-table-email", $email);
$sel->type_ok("identifier=registration-login-table-confirmation-email", $email);
$sel->select_ok("//select[\@name='treatment']", "label=Sr.");
$sel->type_ok("identifier=firstname2", $nombre);
$sel->type_ok("identifier=lastname12", $apellido);
$sel->type_ok("identifier=lastname22", $apellido);
$sel->select_ok("//select[\@name='dayBirth']", "label=31");
$sel->select_ok("//select[\@name='monthBirth']", "label=Diciembre");
$sel->select_ok("//select[\@name='yearBirth']", "label=1990");
$sel->type_ok("identifier=street2", "Callejuela");
$sel->type_ok("identifier=zipcode2", "28028");
$sel->select_ok("//select[\@name='province']", "label=Madrid");
$sel->type_ok("identifier=city2", $poblacion);
$sel->type_ok("identifier=phonenumber2", $telefono);
$sel->type_ok("mobilephone", $telefono);
$sel->click_ok("readRules");
$sel->click_ok("submitButton");
auto_ashish1
Active particpant
Active particpant
Posts : 21
Join date : 2011-03-10

Re: Avoid browser closing on selenium RC shutdown

on Thu Mar 10, 2011 3:04 pm
In java you can avoid the line - selenium.close()
Selenium.close() - closes the browser
selenium.stop() - closes the RC log window


For selenium training, please go to my site - www.sejsoft.com
Sponsored content

Re: Avoid browser closing on selenium RC shutdown

Back to top
Permissions in this forum:
You cannot reply to topics in this forum