You are here

public function BrowserKitDriver::getAttribute in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php \Behat\Mink\Driver\BrowserKitDriver::getAttribute()

Returns element's attribute by it's XPath query.

Parameters

string $xpath:

string $name:

Return value

string|null

Throws

UnsupportedDriverActionException When operation not supported by the driver

DriverException When the operation cannot be done

Overrides CoreDriver::getAttribute

1 call to BrowserKitDriver::getAttribute()
BrowserKitDriver::getValue in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Returns element's value by it's XPath query.

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 376

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function getAttribute($xpath, $name) {
  $node = $this
    ->getFilteredCrawler($xpath);
  if ($this
    ->getCrawlerNode($node)
    ->hasAttribute($name)) {
    return $node
      ->attr($name);
  }
  return null;
}