You are here

public function ElementNotFoundException::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/Exception/ElementNotFoundException.php \Behat\Mink\Exception\ElementNotFoundException::__construct()

Initializes exception.

Parameters

DriverInterface|Session $driver driver instance:

string $type element type:

string $selector element selector type:

string $locator element locator:

Overrides ExpectationException::__construct

File

vendor/behat/mink/src/Exception/ElementNotFoundException.php, line 31

Class

ElementNotFoundException
Exception thrown when an expected element is not found.

Namespace

Behat\Mink\Exception

Code

public function __construct($driver, $type = null, $selector = null, $locator = null) {
  $message = '';
  if (null !== $type) {
    $message .= ucfirst($type);
  }
  else {
    $message .= 'Tag';
  }
  if (null !== $locator) {
    if (null === $selector || in_array($selector, array(
      'css',
      'xpath',
    ))) {
      $selector = 'matching ' . ($selector ?: 'locator');
    }
    else {
      $selector = 'with ' . $selector;
    }
    $message .= ' ' . $selector . ' "' . $locator . '"';
  }
  $message .= ' not found.';
  parent::__construct($message, $driver);
}