You are here

public function BrowserKitDriver::getText 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::getText()

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

Parameters

string $xpath:

Return value

string

Throws

UnsupportedDriverActionException When operation not supported by the driver

DriverException When the operation cannot be done

Overrides CoreDriver::getText

File

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

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function getText($xpath) {
  $text = $this
    ->getFilteredCrawler($xpath)
    ->text();
  $text = str_replace("\n", ' ', $text);
  $text = preg_replace('/ {2,}/', ' ', $text);
  return trim($text);
}