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);

POSTing JSON data using HttpClient

Recently I’ve been putting together a POC in C# that uses a RESTfull service and while there are tons of examples on how to GET data back there is very little info on how to POST data, specially if you want to POST back JSON content.

So here is a simple example, note I’ve used JSON.NET and I’m making use of the dynamic variable only available in C# 4 and above.

using (var client = new HttpClient())
    var request = new CreateAppRequest()
        userAgent = "myAgent",
        endpointId = "1234",
        culture = "en-US"

    var response = client.PostAsync("", 
        new StringContent(JsonConvert.SerializeObject(request).ToString(), 
            Encoding.UTF8, "application/json"))

    if (response.IsSuccessStatusCode)
        dynamic content = JsonConvert.DeserializeObject(

        // Access variables from the returned JSON object
        var appHref = content.links.applications.href;

Source: POSTing JsonObject With HttpClient From New REST API (preview release 4)