コード例 #1
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;
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
 /**
  * Test description.
  *
  * @param array|null $desired_capabilities Desired capabilities.
  * @param array|null $expected             Expected capabilities.
  *
  * @return void
  * @see    SauceLabsBrowserConfigurationTest::testSetDesiredCapabilitiesCorrect()
  */
 public function testSetDesiredCapabilitiesCorrect(array $desired_capabilities = null, array $expected = null)
 {
     $expected = array('k1' => 'v1', 'k2' => 'v2');
     $this->assertSame($this->browser, $this->browser->setDesiredCapabilities($expected));
     $this->assertSame($expected, $this->browser->getDesiredCapabilities());
 }