/**
  *
  * @param  StoryTeller $st
  * @return void
  */
 public function start(StoryTeller $st)
 {
     $httpProxy = new BrowserMobProxyClient();
     $httpProxy->enableFeature('enhancedReplies');
     $this->proxySession = $httpProxy->createProxy();
     // start recording
     $this->proxySession->startHAR();
     // create the browser session
     $webDriver = new WebDriverClient($this->browserDetails->url);
     $this->browserSession = $webDriver->newSession($this->browserDetails->browser, array('proxy' => $this->proxySession->getWebDriverProxyConfig()) + $this->browserDetails->desiredCapabilities);
 }
 /**
  *
  * @param  StoryTeller $st
  * @return void
  */
 public function start(StoryTeller $st)
 {
     // are we using browsermob-proxy?
     $useProxy = false;
     if (fromConfig()->hasModuleSetting('device.browsermob.enable')) {
         $useProxy = fromConfig()->getModuleSetting('device.browsermob.enable');
     }
     // do we have a URL to use?
     $browserUrl = 'http://localhost:4444/wd/hub';
     if (fromConfig()->hasModuleSetting('device.localwebdriver.url')) {
         $browserUrl = fromConfig()->getModuleSetting('device.localwebdriver.url');
     }
     try {
         // by default, we have no proxy session
         $this->proxySession = null;
         // start the proxy if we want it
         if ($useProxy) {
             $httpProxy = new BrowserMobProxyClient();
             $httpProxy->enableFeature('enhancedReplies');
             $this->proxySession = $httpProxy->createProxy();
             // start recording
             $this->proxySession->startHAR();
         }
         // build our requirements for Selenium
         $desiredCapabilities = $this->browserDetails->desiredCapabilities;
         if (is_object($this->proxySession)) {
             $desiredCapabilities['proxy'] = $this->proxySession->getWebDriverProxyConfig();
         }
         // create the browser session
         $webDriver = new WebDriverClient($browserUrl);
         $this->browserSession = $webDriver->newSession($this->browserDetails->browser, $desiredCapabilities);
     } catch (Exception $e) {
         // something went wrong
         throw new E5xx_CannotStartDevice();
     }
 }