1*04fd306cSNickeau<?php 2*04fd306cSNickeau 3*04fd306cSNickeaunamespace Facebook\WebDriver; 4*04fd306cSNickeau 5*04fd306cSNickeau/** 6*04fd306cSNickeau * Interface for an HTML element in the WebDriver framework. 7*04fd306cSNickeau */ 8*04fd306cSNickeauinterface WebDriverElement extends WebDriverSearchContext 9*04fd306cSNickeau{ 10*04fd306cSNickeau /** 11*04fd306cSNickeau * If this element is a TEXTAREA or text INPUT element, this will clear the value. 12*04fd306cSNickeau * 13*04fd306cSNickeau * @return WebDriverElement The current instance. 14*04fd306cSNickeau */ 15*04fd306cSNickeau public function clear(); 16*04fd306cSNickeau 17*04fd306cSNickeau /** 18*04fd306cSNickeau * Click this element. 19*04fd306cSNickeau * 20*04fd306cSNickeau * @return WebDriverElement The current instance. 21*04fd306cSNickeau */ 22*04fd306cSNickeau public function click(); 23*04fd306cSNickeau 24*04fd306cSNickeau /** 25*04fd306cSNickeau * Get the value of the given attribute of the element. 26*04fd306cSNickeau * Attribute is meant what is declared in the HTML markup of the element. 27*04fd306cSNickeau * To read a value of a IDL "JavaScript" property (like `innerHTML`), use `getDomProperty()` method. 28*04fd306cSNickeau * 29*04fd306cSNickeau * @param string $attribute_name The name of the attribute. 30*04fd306cSNickeau * @return string|null The value of the attribute. 31*04fd306cSNickeau */ 32*04fd306cSNickeau public function getAttribute($attribute_name); 33*04fd306cSNickeau 34*04fd306cSNickeau /* 35*04fd306cSNickeau * Gets the value of a IDL JavaScript property of this element (for example `innerHTML`, `tagName` etc.). 36*04fd306cSNickeau * 37*04fd306cSNickeau * @see https://developer.mozilla.org/en-US/docs/Glossary/IDL 38*04fd306cSNickeau * @see https://developer.mozilla.org/en-US/docs/Web/API/Element#properties 39*04fd306cSNickeau * @param string $propertyName 40*04fd306cSNickeau * @return string|null The property's current value or null if the value is not set or the property does not exist. 41*04fd306cSNickeau * @todo Add in next major release (BC) 42*04fd306cSNickeau */ 43*04fd306cSNickeau // public function getDomProperty($propertyName); 44*04fd306cSNickeau 45*04fd306cSNickeau /** 46*04fd306cSNickeau * Get the value of a given CSS property. 47*04fd306cSNickeau * 48*04fd306cSNickeau * @param string $css_property_name The name of the CSS property. 49*04fd306cSNickeau * @return string The value of the CSS property. 50*04fd306cSNickeau */ 51*04fd306cSNickeau public function getCSSValue($css_property_name); 52*04fd306cSNickeau 53*04fd306cSNickeau /** 54*04fd306cSNickeau * Get the location of element relative to the top-left corner of the page. 55*04fd306cSNickeau * 56*04fd306cSNickeau * @return WebDriverPoint The location of the element. 57*04fd306cSNickeau */ 58*04fd306cSNickeau public function getLocation(); 59*04fd306cSNickeau 60*04fd306cSNickeau /** 61*04fd306cSNickeau * Try scrolling the element into the view port and return the location of 62*04fd306cSNickeau * element relative to the top-left corner of the page afterwards. 63*04fd306cSNickeau * 64*04fd306cSNickeau * @return WebDriverPoint The location of the element. 65*04fd306cSNickeau */ 66*04fd306cSNickeau public function getLocationOnScreenOnceScrolledIntoView(); 67*04fd306cSNickeau 68*04fd306cSNickeau /** 69*04fd306cSNickeau * Get the size of element. 70*04fd306cSNickeau * 71*04fd306cSNickeau * @return WebDriverDimension The dimension of the element. 72*04fd306cSNickeau */ 73*04fd306cSNickeau public function getSize(); 74*04fd306cSNickeau 75*04fd306cSNickeau /** 76*04fd306cSNickeau * Get the tag name of this element. 77*04fd306cSNickeau * 78*04fd306cSNickeau * @return string The tag name. 79*04fd306cSNickeau */ 80*04fd306cSNickeau public function getTagName(); 81*04fd306cSNickeau 82*04fd306cSNickeau /** 83*04fd306cSNickeau * Get the visible (i.e. not hidden by CSS) innerText of this element, 84*04fd306cSNickeau * including sub-elements, without any leading or trailing whitespace. 85*04fd306cSNickeau * 86*04fd306cSNickeau * @return string The visible innerText of this element. 87*04fd306cSNickeau */ 88*04fd306cSNickeau public function getText(); 89*04fd306cSNickeau 90*04fd306cSNickeau /** 91*04fd306cSNickeau * Is this element displayed or not? This method avoids the problem of having 92*04fd306cSNickeau * to parse an element's "style" attribute. 93*04fd306cSNickeau * 94*04fd306cSNickeau * @return bool 95*04fd306cSNickeau */ 96*04fd306cSNickeau public function isDisplayed(); 97*04fd306cSNickeau 98*04fd306cSNickeau /** 99*04fd306cSNickeau * Is the element currently enabled or not? This will generally return true 100*04fd306cSNickeau * for everything but disabled input elements. 101*04fd306cSNickeau * 102*04fd306cSNickeau * @return bool 103*04fd306cSNickeau */ 104*04fd306cSNickeau public function isEnabled(); 105*04fd306cSNickeau 106*04fd306cSNickeau /** 107*04fd306cSNickeau * Determine whether or not this element is selected or not. 108*04fd306cSNickeau * 109*04fd306cSNickeau * @return bool 110*04fd306cSNickeau */ 111*04fd306cSNickeau public function isSelected(); 112*04fd306cSNickeau 113*04fd306cSNickeau /** 114*04fd306cSNickeau * Simulate typing into an element, which may set its value. 115*04fd306cSNickeau * 116*04fd306cSNickeau * @param mixed $value The data to be typed. 117*04fd306cSNickeau * @return WebDriverElement The current instance. 118*04fd306cSNickeau */ 119*04fd306cSNickeau public function sendKeys($value); 120*04fd306cSNickeau 121*04fd306cSNickeau /** 122*04fd306cSNickeau * If this current element is a form, or an element within a form, then this 123*04fd306cSNickeau * will be submitted to the remote server. 124*04fd306cSNickeau * 125*04fd306cSNickeau * @return WebDriverElement The current instance. 126*04fd306cSNickeau */ 127*04fd306cSNickeau public function submit(); 128*04fd306cSNickeau 129*04fd306cSNickeau /** 130*04fd306cSNickeau * Get the opaque ID of the element. 131*04fd306cSNickeau * 132*04fd306cSNickeau * @return string The opaque ID. 133*04fd306cSNickeau */ 134*04fd306cSNickeau public function getID(); 135*04fd306cSNickeau 136*04fd306cSNickeau /** 137*04fd306cSNickeau * Take screenshot of a specific element. 138*04fd306cSNickeau * 139*04fd306cSNickeau * @param string $save_as The path of the screenshot to be saved. 140*04fd306cSNickeau * @return string The screenshot in PNG format. 141*04fd306cSNickeau * @todo Add in next major release (BC) 142*04fd306cSNickeau */ 143*04fd306cSNickeau //public function takeElementScreenshot($save_as = null); 144*04fd306cSNickeau} 145