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

Breadcrumb

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

interface ElementInterface

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface
  2. 11.1.x core/modules/config_translation/src/FormElement/ElementInterface.php \Drupal\config_translation\FormElement\ElementInterface

Element interface.

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

Hierarchy

  • interface \Behat\Mink\Element\ElementInterface

Expanded class hierarchy of ElementInterface

All classes that implement ElementInterface

1 file declares its use of ElementInterface
WebAssert.php in vendor/behat/mink/src/WebAssert.php

File

vendor/behat/mink/src/Element/ElementInterface.php, line 20

Namespace

Behat\Mink\Element
View source
interface ElementInterface {
    
    /**
     * Returns XPath for handled element.
     *
     * @return string
     */
    public function getXpath();
    
    /**
     * Returns element's session.
     *
     * @return Session
     *
     * @deprecated Accessing the session from the element is deprecated as of 1.6 and will be impossible in 2.0.
     */
    public function getSession();
    
    /**
     * Checks whether element with specified selector exists inside the current element.
     *
     * @param string       $selector selector engine name
     * @param string|array $locator  selector locator
     *
     * @return bool
     *
     * @see ElementInterface::findAll for the supported selectors
     */
    public function has(string $selector, $locator);
    
    /**
     * Checks if an element still exists in the DOM.
     *
     * @return bool
     */
    public function isValid();
    
    /**
     * Waits for a value to be available and returns it.
     *
     * A falsy value returned by the callback is considered not found and will
     * retry after some waiting time, until a value is found or the timeout is
     * reached.
     * When the timeout is reached, the falsy value of the last attempt is returned.
     *
     * @template T
     *
     * @param int|float           $timeout  Maximal allowed waiting time in seconds.
     * @param callable(static): T $callback Callback, which result is both used as waiting condition and returned.
     *                                      Will receive reference to `this element` as first argument.
     *
     * @return mixed
     *
     * @phpstan-return T
     */
    public function waitFor($timeout, callable $callback);
    
    /**
     * Finds first element with specified selector inside the current element.
     *
     * @param string       $selector selector engine name
     * @param string|array $locator  selector locator
     *
     * @return NodeElement|null
     *
     * @see ElementInterface::findAll for the supported selectors
     */
    public function find(string $selector, $locator);
    
    /**
     * Finds all elements with specified selector inside the current element.
     *
     * Valid selector engines are named, xpath, css, named_partial and named_exact.
     *
     * 'named' is a pseudo selector engine which prefers an exact match but
     * will return a partial match if no exact match is found.
     * 'xpath' is a pseudo selector engine supported by SelectorsHandler.
     *
     * More selector engines can be registered in the SelectorsHandler.
     *
     * @param string       $selector selector engine name
     * @param string|array $locator  selector locator
     *
     * @return NodeElement[]
     *
     * @see NamedSelector for the locators supported by the named selectors
     */
    public function findAll(string $selector, $locator);
    
    /**
     * Returns element text (inside tag).
     *
     * @return string
     */
    public function getText();
    
    /**
     * Returns element inner html.
     *
     * @return string
     */
    public function getHtml();

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overrides
ElementInterface::find public function Finds first element with specified selector inside the current element. 1
ElementInterface::findAll public function Finds all elements with specified selector inside the current element. 1
ElementInterface::getHtml public function Returns element inner html. 1
ElementInterface::getSession Deprecated public function Returns element&#039;s session. 1
ElementInterface::getText public function Returns element text (inside tag). 1
ElementInterface::getXpath public function Returns XPath for handled element. 2
ElementInterface::has public function Checks whether element with specified selector exists inside the current element. 1
ElementInterface::isValid public function Checks if an element still exists in the DOM. 1
ElementInterface::waitFor public function Waits for a value to be available and returns it. 1

API Navigation

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