Getting the Selenium session id when using Protractor

This was actually a rather tricky thing to find any information so here’s how to output the Selenium session id into the console when using Protractor. I needed to do this in order for Bamboo to pick up on the Sauce Labs jobs running.

function printSessionId(jobName){
  browser.getSession().then(function(session) {
    console.log('SauceOnDemandSessionID=' + session.getId() + ' job-name=' + jobName);
  });
}
Advertisements

Published by

Alan Feekery

Developer, Gamer, Musician, Cyclist and big Motorsport fan... enjoys the odd cup of coffee :)

One thought on “Getting the Selenium session id when using Protractor”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s