Skip to content

Instantly share code, notes, and snippets.

@dash1291
Last active August 29, 2015 14:03
Show Gist options
  • Save dash1291/d75fe47644b357e957fc to your computer and use it in GitHub Desktop.
Save dash1291/d75fe47644b357e957fc to your computer and use it in GitHub Desktop.
BASE_URL="http://hub.browserstack.com/wd/hub"
res=`curl -X POST -u $AUTH_NAME:$AUTH_KEY -d '{"desiredCapabilities":{"browser": "firefox"}}' $BASE_URL/session`
sessionId=`echo $res | sed -n 's/.*\"sessionId\":\"\([^"]*\).*/\1/p'`
# Open URL
res=`curl -X POST -u $AUTH_NAME:$AUTH_KEY -d '{"url":"http://google.com"}' $BASE_URL/session/$sessionId/url`
# Get title
res=`curl -X GET -u $AUTH_NAME:$AUTH_KEY $BASE_URL/session/$sessionId/title`
title=`echo $res | sed -n 's/.*\"value\":\"\([^"]*\).*/\1/p'`
if [[ $title == "Google" ]]
then
echo "We good"
else
echo "Something wrong"
fi
# quite the session
res=`curl -X DELETE -u $AUTH_NAME:$AUTH_KEY $BASE_URL/session/$sessionId`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment