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

Breadcrumb

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

class ElementNotFoundException

Exception thrown when an expected element is not found.

@author Konstantin Kudryashov <ever.zet@gmail.com>

Hierarchy

  • class \Behat\Mink\Exception\Exception extends \Behat\Mink\Exception\Exception
    • class \Behat\Mink\Exception\Exception extends \Behat\Mink\Exception\Exception
      • class \Behat\Mink\Exception\ExpectationException extends \Behat\Mink\Exception\Exception
        • class \Behat\Mink\Exception\ElementNotFoundException extends \Behat\Mink\Exception\ExpectationException

Expanded class hierarchy of ElementNotFoundException

4 files declare their use of ElementNotFoundException
Element.php in vendor/behat/mink/src/Element/Element.php
NodeElement.php in vendor/behat/mink/src/Element/NodeElement.php
TraversableElement.php in vendor/behat/mink/src/Element/TraversableElement.php
WebAssert.php in vendor/behat/mink/src/WebAssert.php

File

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

Namespace

Behat\Mink\Exception
View source
class ElementNotFoundException extends ExpectationException {
    
    /**
     * Initializes exception.
     *
     * @param DriverInterface|Session $driver   driver instance
     * @param string|null             $type     element type
     * @param string|null             $selector element selector type
     * @param string|null             $locator  element locator
     */
    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);
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
ElementNotFoundException::__construct public function Initializes exception. Overrides ExpectationException::__construct
ExpectationException::$driver private property
ExpectationException::$session private property
ExpectationException::getContext protected function Gets the context rendered for this exception. 2
ExpectationException::getDriver protected function Returns driver.
ExpectationException::getResponseInfo protected function Returns response information string.
ExpectationException::getSession Deprecated protected function Returns exception session.
ExpectationException::pipeString protected function Prepends every line in a string with pipe (|).
ExpectationException::trimBody protected function Removes response header/footer, letting only &lt;body /&gt; content.
ExpectationException::trimString protected function Trims string to specified number of chars.
ExpectationException::__toString public function Returns exception message with additional context info.

API Navigation

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