/**
* Starts new Selenium session
* @param DesiredCapabilities $desiredCapabilities
* @throws \Exception
*/
private function startSession(DesiredCapabilities $desiredCapabilities)
{
if ($desiredCapabilities->getBrowserName() == null || trim($desiredCapabilities->getBrowserName()) == '') {
throw new \Exception("Can not start session if browser name is not specified");
}
$params = array('desiredCapabilities' => $desiredCapabilities->getCapabilities());
$command = new Commands\Command($this, 'start_session', $params);
$results = $command->execute();
$this->_sessionId = $results['sessionId'];
$this->_capabilities = $results['value'];
return $this->_capabilities;
}