Reuse Session

13 views
Skip to first unread message

Jim Buttafuoco

unread,
Mar 26, 2018, 2:18:28 PM3/26/18
to Selenium Remote Driver
I am looking for a way to reuse a current session without restarting Firefox.  I have to navigate a web site and it would be helpful if I didn't have to start from the beginning each time I make a code change.

Thanks
Jim

George Baugh

unread,
Mar 27, 2018, 5:49:36 PM3/27/18
to Selenium Remote Driver
Turn off auto_close, and grab the object's session_id.  Then use it in the constructor:

use File::Slurp;
use Selenium::Remote::Driver;

my $srd = Selenium::Remote::Driver->new(...);
$srd->auto_close(0);
my $sessid = $srd->session_id();
`echo $sessid > /selenium_session`
die;

...some other script:

my $srd = Selenium::Remote::Driver->new( session_id => File::Slurp::read_file('/selenium_session'));
...


Should work, if it doesn't file a bug.  Also be sure you don't have the auto reaping turned on in your selenium server configuration.

GSB
Reply all
Reply to author
Forward
0 new messages