How do I get my session ID for passing to Sauce Labs in Perl?

150 views
Skip to first unread message

Phil Wells

unread,
Mar 2, 2014, 4:42:12 PM3/2/14
to seleniu...@googlegroups.com
In order to send a test's pass/fail status to Sauce Labs I need to get my Selenium session ID and pass it as the Sauce job ID.  There's a get_sessions() method in Selenium::Remote::Driver that should return Selenium session Id(s) and its or their capabilities.  When I try passing this prior to quitting the driver, I get the following message:

Error while executing command: Server returned error message The command you just sent (GET sessions) has no session ID,
 but it should.
This is generally caused by testing frameworks trying to run commands after the conclusion of a test.
For example, you may be trying to capture a screenshot or retrieve server logs after you call
selenium.stop() or driver.quit() in your tearDown method.  Make sure this
process happens before the session is finished. 

Here's how I'm trying to get at it:

print "!! - job info: ", $sel->get_sessions()->{id}\n"; 

I've tried putting that near the beginning and end of my script, and even right between tests which otherwise run fine, and I get the same message.  Has anyone had any success with getting the session ID for their Perl tests? 
Reply all
Reply to author
Forward
0 new messages