From 6f44ac67427e5a7d19253e4e0c6c324658d994f3 Mon Sep 17 00:00:00 2001 From: chibimagic Date: Fri, 20 Mar 2015 19:04:39 -0700 Subject: [PATCH] BrwoserStack: Retrieve information about the current session --- WebDriver/Driver.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/WebDriver/Driver.php b/WebDriver/Driver.php index acc784d..18eba93 100644 --- a/WebDriver/Driver.php +++ b/WebDriver/Driver.php @@ -138,6 +138,17 @@ public function sauce_url() { } } + public function browserstack_info() { + if ($this->running_at_browserstack()) { + $url_parts = parse_url($this->server_url); + $response = WebDriver::Curl("GET", "https://" . $url_parts['user'] . ":" . $url_parts['pass'] . "@www.browserstack.com/automate/sessions/" . $this->session_id . ".json"); + $result = json_decode(trim($response['body']), true); + return $result['automation_session']; + } else { + return false; + } + } + public function execute($http_type, $relative_url, $payload = null) { if ($payload !== null) { $payload = json_encode($payload);