You are here

protected function BasePhantomJSDriver::findElement in Zircon Profile 8

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

Helper to find a node element given an xpath

@returns int

Parameters

string $xpath:

int $max:

Throws

DriverException

7 calls to BasePhantomJSDriver::findElement()
PhantomJSDriver::attachFile in vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php
Upload a file to the browser
PhantomJSDriver::blur in vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php
Blur on element
PhantomJSDriver::dragTo in vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php
Drags one element to another
PhantomJSDriver::focus in vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php
Focus on an element
PhantomJSDriver::getAttribute in vendor/jcalderonzumba/mink-phantomjs-driver/src/PhantomJSDriver.php
Gets the attribute value of a given element and name

... See full list

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/BasePhantomJSDriver.php, line 67

Class

BasePhantomJSDriver
Class BasePhantomJSDriver @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

protected function findElement($xpath, $max = 1) {
  $elements = $this->browser
    ->find("xpath", $xpath);
  if (!isset($elements["page_id"]) || !isset($elements["ids"]) || count($elements["ids"]) !== $max) {
    throw new DriverException("Failed to get elements with given {$xpath}");
  }
  return $elements;
}