Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Selenium RC - How to reuse bowser session?

by zerocred (Beadle)
on Mar 21, 2010 at 15:56 UTC ( [id://829958]=perlquestion: print w/replies, xml ) Need Help??

zerocred has asked for the wisdom of the Perl Monks concerning the following question:

Hallo All,

I'm using Selenium RC to automate website interaction. It would simplify and speed tasks if I can reuse an existing or previously set up browser session.

I already have set -browserSessionReuse option in the server and the auto_stop="0" so it leaves the browser running. When I set up a new connection I get this:

23:19:04.828 INFO - Command request: getNewBrowserSession[*iexplore, h +ttp://www.example.com/] on session null 23:19:04.828 INFO - grabbing available session... 23:19:04.828 INFO - creating new remote session 23:19:04.828 INFO - Allocated session eb2150d86aac4aa8812287aab1dae0df + for http://www.example.com/, launching... 23:19:04.921 INFO - Launching Embedded Internet Explorer... 23:19:05.921 INFO - Launching Internet Explorer HTA...

It seems to grab the available session but the 'Test::WWW::Selenium->new()'probably overwrites it - any alternative?, What am I doing wrong.

I see there is a session_id option mentioned in earlier documentation (but not current cpan documentation) - but not how to get it or use it...

I've seen mention of reusing the session in Java - but it seems to use a command not available in Perl - is that the case?

Cheers!

David

Replies are listed 'Best First'.
Re: Selenium RC - How to reuse bowser session?
by Anonymous Monk on Mar 21, 2010 at 16:08 UTC
    I've seen mention of reusing the session in Java - but it seems to use a command not available in Perl - is that the case?

    Link?

      http://groups.google.com/group/selenium-users/browse_frm/thread/40c943d3e8813af9/ed18dee8c7781dbe?lnk=gst&q=reuse+browser+session#ed18dee8c7781dbe
      public void startBrowser(String pstrBaseUrl, String pstrTimeou +tInMilliseconds) throws Exception { browser = new DefaultSelenium("localhost", 4444, "*chrome", ps +trBaseUrl); browser.start(); browser.setTimeout(pstrTimeoutInMilliseconds); }
      in the code in message 5. Unless I'm misunderstanding what is going on - (I dunno much about Java)

      This one is better:

      http://groups.google.com/group/selenium-users/browse_frm/thread/403b2b93e6e0e2b2/e16702ec4686cd1f?lnk=gst&q=reuse+browser+session+id#e16702ec4686cd1f
      RemoteControlConfiguration rcc = new RemoteControlConfiguration(); rcc.reuseBrowserSessions(); SeleniumServer ss = new SeleniumServer(rcc); ss.start();

      What is the RemoteControlConfiguration()? or is that a home made function somewhere

        Try manually setting/reusing
        my $sel = ...->new( session_id => 'magic string', # OR $sel->{session_id} = 'magic string';
        or, if getExistingBrowserSession exists
        $sel->{session_id} = $sel->get_string("getExistingBrowserSession", $sel->{browser_start_comma +nd}, $sel->{browser_url});

        Also "session_id = Optional argument that can be used to reuse session_ids between test runs. This can make for faster testing." is mentioned as arguments for:

        $sel = WWW::Selenium->new( %args )

        In some (old?) documentation here:

        http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/perl/WWW-Selenium.html#element_locators

        but not in cpan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://829958]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found