Skip to content

Commit

Permalink
Updated the driver for the Mink 2.0 API
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Jan 19, 2014
1 parent 018ec1c commit 59e158e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

"require": {
"php": ">=5.3.1",
"behat/mink": "~1.5.0@dev",
"behat/mink": "dev-2-architecture-changes",
"instaclick/php-webdriver": "~1.1"
},

Expand Down
26 changes: 3 additions & 23 deletions src/Behat/Mink/Driver/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Behat\Mink\Driver;

use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Session;
use WebDriver\Exception\UnknownError;
use WebDriver\Key;
use WebDriver\WebDriver;
Expand All @@ -24,12 +22,6 @@
*/
class Selenium2Driver extends CoreDriver
{
/**
* The current Mink session
* @var \Behat\Mink\Session
*/
private $session;

/**
* Whether the browser has been started
* @var Boolean
Expand Down Expand Up @@ -103,7 +95,7 @@ protected function setBrowserName($browserName = 'firefox')

/**
* Sets the desired capabilities - called on construction. If null is provided, will set the
* defaults as dsesired.
* defaults as desired.
*
* See http://code.google.com/p/selenium/wiki/DesiredCapabilities
*
Expand Down Expand Up @@ -262,14 +254,6 @@ protected function executeJsOnXpath($xpath, $script, $sync = true)
));
}

/**
* @see Behat\Mink\Driver\DriverInterface::setSession()
*/
public function setSession(Session $session)
{
$this->session = $session;
}

/**
* Starts driver.
*/
Expand Down Expand Up @@ -498,19 +482,15 @@ public function getWindowName()
}

/**
* Finds elements with specified XPath query.
*
* @param string $xpath
*
* @return array array of Behat\Mink\Element\NodeElement
* {@inheritdoc}
*/
public function find($xpath)
{
$nodes = $this->wdSession->elements('xpath', $xpath);

$elements = array();
foreach ($nodes as $i => $node) {
$elements[] = new NodeElement(sprintf('(%s)[%d]', $xpath, $i+1), $this->session);
$elements[] = sprintf('(%s)[%d]', $xpath, $i+1);
}

return $elements;
Expand Down

0 comments on commit 59e158e

Please sign in to comment.