Back to Resources


Posted June 6, 2013

Job IDs; What Are They Good for?


What's a Job ID?

You've might have come across the term "job ID", "test ID" or "session ID" in our documentation. These refer to the unique ID which each Sauce Labs job has. You can find it in the URL of a jobs page, and in the test summary pane.

This value is also used by any remote Selenium session as the session ID. When you use the selenium-webdriver or sauce gems to drive a job, every action you take until you call #quit is performed for the same session.


So once you have this session ID, you've got a unique reference to a job and all its resources. This means you can use it to:

  • Set job metadata like build-id, using our REST API

  • Download all screenshots, or the Selenium log, or the test video

  • Stop a job remotely

  • Drop links to failing test videos in Campfire

  • Get faster support from

(By the way, the following examples are for Ruby, but all these tasks are possible with other languages... Check out the 'Download the Video' and 'Stop a job remotely' examples)

Obtaining the ID programmatically

Previously, getting the session ID from a selenium-webdriver object was... well... If it was a baby, you'd tell the mother it had an "interesting" face and then immediately change the subject (here's the discussion why). So, you might encounter some examples like this:

## I... You... *{hurk}* job_id = @driver.send(:@bridge).session_id

What is this I don't even

job_id = @driver.instance_variable_get("@bridge").instance_variable_get("@session_id")

Well, none of that. Jari Bakken has added a sweet convenience method directly to the remote driver:

job_id = @driver.session_id

Using it

The session_id is just a string, so with a little bit of setting up, it becomes super easy to do all the stuff listed above.

job_id = @driver.session_id un = Sauce.get_config[:username] ac = Sauce.get_config[:access_key]

****Provide links to jobs

**Set Metadata with Sauce_Whisk


job = => job_id) = "1337"

**Stop a job remotely


**Download the video


Easy, huh?

Jun 6, 2013
Share this post
Copy Share Link
© 2023 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.