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