Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Behat\Mink\Element; Chris@0: Chris@0: use Behat\Mink\Session; Chris@0: Chris@0: /** Chris@0: * Element interface. Chris@0: * Chris@0: * @author Konstantin Kudryashov Chris@0: */ Chris@0: interface ElementInterface Chris@0: { Chris@0: /** Chris@0: * Returns XPath for handled element. Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getXpath(); Chris@0: Chris@0: /** Chris@0: * Returns element's session. Chris@0: * Chris@0: * @return Session Chris@0: * Chris@0: * @deprecated Accessing the session from the element is deprecated as of 1.6 and will be impossible in 2.0. Chris@0: */ Chris@0: public function getSession(); Chris@0: Chris@0: /** Chris@0: * Checks whether element with specified selector exists inside the current element. Chris@0: * Chris@0: * @param string $selector selector engine name Chris@0: * @param string|array $locator selector locator Chris@0: * Chris@0: * @return Boolean Chris@0: * Chris@0: * @see ElementInterface::findAll for the supported selectors Chris@0: */ Chris@0: public function has($selector, $locator); Chris@0: Chris@0: /** Chris@0: * Checks if an element still exists in the DOM. Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function isValid(); Chris@0: Chris@0: /** Chris@0: * Waits for an element(-s) to appear and returns it. Chris@0: * Chris@0: * @param int|float $timeout Maximal allowed waiting time in seconds. Chris@0: * @param callable $callback Callback, which result is both used as waiting condition and returned. Chris@0: * Will receive reference to `this element` as first argument. Chris@0: * Chris@0: * @return mixed Chris@0: * Chris@0: * @throws \InvalidArgumentException When invalid callback given. Chris@0: */ Chris@0: public function waitFor($timeout, $callback); Chris@0: Chris@0: /** Chris@0: * Finds first element with specified selector inside the current element. Chris@0: * Chris@0: * @param string $selector selector engine name Chris@0: * @param string|array $locator selector locator Chris@0: * Chris@0: * @return NodeElement|null Chris@0: * Chris@0: * @see ElementInterface::findAll for the supported selectors Chris@0: */ Chris@0: public function find($selector, $locator); Chris@0: Chris@0: /** Chris@0: * Finds all elements with specified selector inside the current element. Chris@0: * Chris@0: * Valid selector engines are named, xpath, css, named_partial and named_exact. Chris@0: * Chris@0: * 'named' is a pseudo selector engine which prefers an exact match but Chris@0: * will return a partial match if no exact match is found. Chris@0: * 'xpath' is a pseudo selector engine supported by SelectorsHandler. Chris@0: * Chris@0: * More selector engines can be registered in the SelectorsHandler. Chris@0: * Chris@0: * @param string $selector selector engine name Chris@0: * @param string|array $locator selector locator Chris@0: * Chris@0: * @return NodeElement[] Chris@0: * Chris@0: * @see NamedSelector for the locators supported by the named selectors Chris@0: */ Chris@0: public function findAll($selector, $locator); Chris@0: Chris@0: /** Chris@0: * Returns element text (inside tag). Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getText(); Chris@0: Chris@0: /** Chris@0: * Returns element inner html. Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getHtml(); Chris@0: }