/**
  * Returns a new driver instance according to the browser configuration.
  *
  * @param BrowserConfiguration $browser The browser configuration.
  *
  * @return DriverInterface
  */
 public function createDriver(BrowserConfiguration $browser)
 {
     if (!class_exists('Behat\\Mink\\Driver\\SahiDriver')) {
         throw new \RuntimeException('Install MinkSahiDriver in order to use sahi driver.');
     }
     $driver_options = $browser->getDriverOptions();
     $connection = new \Behat\SahiClient\Connection($driver_options['sid'], $browser->getHost(), $browser->getPort(), $driver_options['browser'], $driver_options['limit']);
     return new \Behat\Mink\Driver\SahiDriver($browser->getBrowserName(), new \Behat\SahiClient\Client($connection));
 }
Example #2
0
 /**
  * Creates driver based on browser configuration.
  *
  * @param BrowserConfiguration $browser Browser configuration.
  *
  * @return DriverInterface
  */
 private function _createDriver(BrowserConfiguration $browser)
 {
     $browser_name = $browser->getBrowserName();
     $capabilities = $browser->getDesiredCapabilities();
     $capabilities['browserName'] = $browser_name;
     // TODO: maybe doesn't work!
     ini_set('default_socket_timeout', $browser->getTimeout());
     $driver = new Selenium2Driver($browser_name, $capabilities, 'http://' . $browser->getHost() . ':' . $browser->getPort() . '/wd/hub');
     return $driver;
 }
 /**
  * Returns a new driver instance according to the browser configuration.
  *
  * @param BrowserConfiguration $browser The browser configuration.
  *
  * @return DriverInterface
  */
 public function createDriver(BrowserConfiguration $browser)
 {
     if (!class_exists('Behat\\Mink\\Driver\\Selenium2Driver')) {
         throw new \RuntimeException('Install MinkSelenium2Driver in order to use selenium2 driver.');
     }
     $browser_name = $browser->getBrowserName();
     $capabilities = $browser->getDesiredCapabilities();
     $capabilities['browserName'] = $browser_name;
     // TODO: Maybe doesn't work!
     ini_set('default_socket_timeout', $browser->getTimeout());
     $driver = new \Behat\Mink\Driver\Selenium2Driver($browser_name, $capabilities, 'http://' . $browser->getHost() . ':' . $browser->getPort() . '/wd/hub');
     return $driver;
 }
 /**
  * Returns browser name from browser configuration.
  *
  * @return string
  */
 public function getBrowserName()
 {
     $browser_name = parent::getBrowserName();
     return strlen($browser_name) ? $browser_name : 'chrome';
 }
 /**
  * Test description.
  *
  * @return void
  */
 public function testSetBrowserNameCorrect()
 {
     $expected = 'firefox';
     $this->assertSame($this->browser, $this->browser->setBrowserName($expected));
     $this->assertSame($expected, $this->browser->getBrowserName());
 }