Exemplo n.º 1
0
 public function setUp()
 {
     $this->_testUrl = "http://nearsoft-php-seleniumclient.herokuapp.com/sandbox/";
     $desiredCapabilities = new DesiredCapabilities();
     $desiredCapabilities->setCapability(CapabilityType::BROWSER_NAME, BrowserType::FIREFOX);
     $desiredCapabilities->setCapability(CapabilityType::VERSION, "24.0");
     $desiredCapabilities->setCapability(CapabilityType::PLATFORM, PlatformType::WINDOWS);
     $this->_driver = new WebDriver($desiredCapabilities);
     //note that the actual capabilities supported may be different to the desired capabilities specified
 }
Exemplo n.º 2
0
 /**
  * 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;
 }