4 * This file is part of the Mink package.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Mink\Element;
13 use Behat\Mink\Session;
18 * @author Konstantin Kudryashov <ever.zet@gmail.com>
20 interface ElementInterface
23 * Returns XPath for handled element.
27 public function getXpath();
30 * Returns element's session.
34 * @deprecated Accessing the session from the element is deprecated as of 1.6 and will be impossible in 2.0.
36 public function getSession();
39 * Checks whether element with specified selector exists inside the current element.
41 * @param string $selector selector engine name
42 * @param string|array $locator selector locator
46 * @see ElementInterface::findAll for the supported selectors
48 public function has($selector, $locator);
51 * Checks if an element still exists in the DOM.
55 public function isValid();
58 * Waits for an element(-s) to appear and returns it.
60 * @param int|float $timeout Maximal allowed waiting time in seconds.
61 * @param callable $callback Callback, which result is both used as waiting condition and returned.
62 * Will receive reference to `this element` as first argument.
66 * @throws \InvalidArgumentException When invalid callback given.
68 public function waitFor($timeout, $callback);
71 * Finds first element with specified selector inside the current element.
73 * @param string $selector selector engine name
74 * @param string|array $locator selector locator
76 * @return NodeElement|null
78 * @see ElementInterface::findAll for the supported selectors
80 public function find($selector, $locator);
83 * Finds all elements with specified selector inside the current element.
85 * Valid selector engines are named, xpath, css, named_partial and named_exact.
87 * 'named' is a pseudo selector engine which prefers an exact match but
88 * will return a partial match if no exact match is found.
89 * 'xpath' is a pseudo selector engine supported by SelectorsHandler.
91 * More selector engines can be registered in the SelectorsHandler.
93 * @param string $selector selector engine name
94 * @param string|array $locator selector locator
96 * @return NodeElement[]
98 * @see NamedSelector for the locators supported by the named selectors
100 public function findAll($selector, $locator);
103 * Returns element text (inside tag).
107 public function getText();
110 * Returns element inner html.
114 public function getHtml();