You are here

public function PhantomJSDriver::find in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php \Zumba\Mink\Driver\PhantomJSDriver::find()

Finds elements with specified XPath query.

Parameters

string $xpath:

Return value

NodeElement[]

Throws

DriverException When the operation cannot be done

Overrides CoreDriver::find

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php, line 150

Class

PhantomJSDriver
Class PhantomJSDriver @package Behat\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

public function find($xpath) {
  $elements = $this->browser
    ->find("xpath", $xpath);
  $nodeElements = array();
  if (!isset($elements["ids"])) {
    return null;
  }
  foreach ($elements["ids"] as $i => $elementId) {
    $nodeElements[] = new NodeElement(sprintf('(%s)[%d]', $xpath, $i + 1), $this->session);
  }
  return $nodeElements;
}