Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ElementNotFoundException.php

function ElementNotFoundException::__construct

Initializes exception.

Parameters

DriverInterface|Session $driver driver instance:

string|null $type element type:

string|null $selector element selector type:

string|null $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, ?string $type = null, ?string $selector = null, ?string $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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal