annotate vendor/behat/mink/src/Element/ElementInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of the Mink package.
Chris@0 5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
Chris@0 6 *
Chris@0 7 * For the full copyright and license information, please view the LICENSE
Chris@0 8 * file that was distributed with this source code.
Chris@0 9 */
Chris@0 10
Chris@0 11 namespace Behat\Mink\Element;
Chris@0 12
Chris@0 13 use Behat\Mink\Session;
Chris@0 14
Chris@0 15 /**
Chris@0 16 * Element interface.
Chris@0 17 *
Chris@0 18 * @author Konstantin Kudryashov <ever.zet@gmail.com>
Chris@0 19 */
Chris@0 20 interface ElementInterface
Chris@0 21 {
Chris@0 22 /**
Chris@0 23 * Returns XPath for handled element.
Chris@0 24 *
Chris@0 25 * @return string
Chris@0 26 */
Chris@0 27 public function getXpath();
Chris@0 28
Chris@0 29 /**
Chris@0 30 * Returns element's session.
Chris@0 31 *
Chris@0 32 * @return Session
Chris@0 33 *
Chris@0 34 * @deprecated Accessing the session from the element is deprecated as of 1.6 and will be impossible in 2.0.
Chris@0 35 */
Chris@0 36 public function getSession();
Chris@0 37
Chris@0 38 /**
Chris@0 39 * Checks whether element with specified selector exists inside the current element.
Chris@0 40 *
Chris@0 41 * @param string $selector selector engine name
Chris@0 42 * @param string|array $locator selector locator
Chris@0 43 *
Chris@0 44 * @return Boolean
Chris@0 45 *
Chris@0 46 * @see ElementInterface::findAll for the supported selectors
Chris@0 47 */
Chris@0 48 public function has($selector, $locator);
Chris@0 49
Chris@0 50 /**
Chris@0 51 * Checks if an element still exists in the DOM.
Chris@0 52 *
Chris@0 53 * @return bool
Chris@0 54 */
Chris@0 55 public function isValid();
Chris@0 56
Chris@0 57 /**
Chris@0 58 * Waits for an element(-s) to appear and returns it.
Chris@0 59 *
Chris@0 60 * @param int|float $timeout Maximal allowed waiting time in seconds.
Chris@0 61 * @param callable $callback Callback, which result is both used as waiting condition and returned.
Chris@0 62 * Will receive reference to `this element` as first argument.
Chris@0 63 *
Chris@0 64 * @return mixed
Chris@0 65 *
Chris@0 66 * @throws \InvalidArgumentException When invalid callback given.
Chris@0 67 */
Chris@0 68 public function waitFor($timeout, $callback);
Chris@0 69
Chris@0 70 /**
Chris@0 71 * Finds first element with specified selector inside the current element.
Chris@0 72 *
Chris@0 73 * @param string $selector selector engine name
Chris@0 74 * @param string|array $locator selector locator
Chris@0 75 *
Chris@0 76 * @return NodeElement|null
Chris@0 77 *
Chris@0 78 * @see ElementInterface::findAll for the supported selectors
Chris@0 79 */
Chris@0 80 public function find($selector, $locator);
Chris@0 81
Chris@0 82 /**
Chris@0 83 * Finds all elements with specified selector inside the current element.
Chris@0 84 *
Chris@0 85 * Valid selector engines are named, xpath, css, named_partial and named_exact.
Chris@0 86 *
Chris@0 87 * 'named' is a pseudo selector engine which prefers an exact match but
Chris@0 88 * will return a partial match if no exact match is found.
Chris@0 89 * 'xpath' is a pseudo selector engine supported by SelectorsHandler.
Chris@0 90 *
Chris@0 91 * More selector engines can be registered in the SelectorsHandler.
Chris@0 92 *
Chris@0 93 * @param string $selector selector engine name
Chris@0 94 * @param string|array $locator selector locator
Chris@0 95 *
Chris@0 96 * @return NodeElement[]
Chris@0 97 *
Chris@0 98 * @see NamedSelector for the locators supported by the named selectors
Chris@0 99 */
Chris@0 100 public function findAll($selector, $locator);
Chris@0 101
Chris@0 102 /**
Chris@0 103 * Returns element text (inside tag).
Chris@0 104 *
Chris@0 105 * @return string
Chris@0 106 */
Chris@0 107 public function getText();
Chris@0 108
Chris@0 109 /**
Chris@0 110 * Returns element inner html.
Chris@0 111 *
Chris@0 112 * @return string
Chris@0 113 */
Chris@0 114 public function getHtml();
Chris@0 115 }