"Fossies" - the Fresh Open Source Software Archive 
Member "selenium-selenium-4.8.1/dotnet/src/webdriver/IWebElement.cs" (17 Feb 2023, 11913 Bytes) of package /linux/www/selenium-selenium-4.8.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C# source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "IWebElement.cs" see the
Fossies "Dox" file reference documentation.
1 // <copyright file="IWebElement.cs" company="WebDriver Committers">
2 // Licensed to the Software Freedom Conservancy (SFC) under one
3 // or more contributor license agreements. See the NOTICE file
4 // distributed with this work for additional information
5 // regarding copyright ownership. The SFC licenses this file
6 // to you under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // </copyright>
18
19 using System;
20 using System.Drawing;
21
22 namespace OpenQA.Selenium
23 {
24 /// <summary>
25 /// Defines the interface through which the user controls elements on the page.
26 /// </summary>
27 /// <remarks>The <see cref="IWebElement"/> interface represents an HTML element.
28 /// Generally, all interesting operations to do with interacting with a page will
29 /// be performed through this interface.
30 /// </remarks>
31 public interface IWebElement : ISearchContext
32 {
33 /// <summary>
34 /// Gets the tag name of this element.
35 /// </summary>
36 /// <remarks>
37 /// The <see cref="TagName"/> property returns the tag name of the
38 /// element, not the value of the name attribute. For example, it will return
39 /// "input" for an element specified by the HTML markup <input name="foo" />.
40 /// </remarks>
41 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
42 string TagName { get; }
43
44 /// <summary>
45 /// Get the visible (i.e. not hidden by CSS) text of this element, including sub-elements.
46 /// </summary>
47 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
48 string Text { get; }
49
50 /// <summary>
51 /// Gets a value indicating whether or not this element is enabled.
52 /// </summary>
53 /// <remarks>The <see cref="Enabled"/> property will generally
54 /// return <see langword="true"/> for everything except explicitly disabled input elements.</remarks>
55 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
56 bool Enabled { get; }
57
58 /// <summary>
59 /// Gets a value indicating whether or not this element is selected.
60 /// </summary>
61 /// <remarks>This operation only applies to input elements such as checkboxes,
62 /// options in a select element and radio buttons.</remarks>
63 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
64 bool Selected { get; }
65
66 /// <summary>
67 /// Gets a <see cref="Point"/> object containing the coordinates of the upper-left corner
68 /// of this element relative to the upper-left corner of the page.
69 /// </summary>
70 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
71 Point Location { get; }
72
73 /// <summary>
74 /// Gets a <see cref="Size"/> object containing the height and width of this element.
75 /// </summary>
76 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
77 Size Size { get; }
78
79 /// <summary>
80 /// Gets a value indicating whether or not this element is displayed.
81 /// </summary>
82 /// <remarks>The <see cref="Displayed"/> property avoids the problem
83 /// of having to parse an element's "style" attribute to determine
84 /// visibility of an element.</remarks>
85 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
86 bool Displayed { get; }
87
88 /// <summary>
89 /// Clears the content of this element.
90 /// </summary>
91 /// <remarks>If this element is a text entry element, the <see cref="Clear"/>
92 /// method will clear the value. It has no effect on other elements. Text entry elements
93 /// are defined as elements with INPUT or TEXTAREA tags.</remarks>
94 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
95 void Clear();
96
97 /// <summary>
98 /// Simulates typing text into the element.
99 /// </summary>
100 /// <param name="text">The text to type into the element.</param>
101 /// <remarks>The text to be typed may include special characters like arrow keys,
102 /// backspaces, function keys, and so on. Valid special keys are defined in
103 /// <see cref="Keys"/>.</remarks>
104 /// <seealso cref="Keys"/>
105 /// <exception cref="InvalidElementStateException">Thrown when the target element is not enabled.</exception>
106 /// <exception cref="ElementNotVisibleException">Thrown when the target element is not visible.</exception>
107 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
108 void SendKeys(string text);
109
110 /// <summary>
111 /// Submits this element to the web server.
112 /// </summary>
113 /// <remarks>If this current element is a form, or an element within a form,
114 /// then this will be submitted to the web server. If this causes the current
115 /// page to change, then this method will block until the new page is loaded.</remarks>
116 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
117 void Submit();
118
119 /// <summary>
120 /// Clicks this element.
121 /// </summary>
122 /// <remarks>
123 /// <para>
124 /// Click this element. If the click causes a new page to load, the <see cref="Click"/>
125 /// method will attempt to block until the page has loaded. After calling the
126 /// <see cref="Click"/> method, you should discard all references to this
127 /// element unless you know that the element and the page will still be present.
128 /// Otherwise, any further operations performed on this element will have an undefined.
129 /// behavior.
130 /// </para>
131 /// <para>
132 /// If this element is not clickable, then this operation is ignored. This allows you to
133 /// simulate a users to accidentally missing the target when clicking.
134 /// </para>
135 /// </remarks>
136 /// <exception cref="ElementNotVisibleException">Thrown when the target element is not visible.</exception>
137 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
138 void Click();
139
140 /// <summary>
141 /// Gets the value of the specified attribute for this element.
142 /// </summary>
143 /// <param name="attributeName">The name of the attribute.</param>
144 /// <returns>The attribute's current value. Returns a <see langword="null"/> if the
145 /// value is not set.</returns>
146 /// <remarks>The <see cref="GetAttribute"/> method will return the current value
147 /// of the attribute, even if the value has been modified after the page has been
148 /// loaded. Note that the value of the following attributes will be returned even if
149 /// there is no explicit attribute on the element:
150 /// <list type="table">
151 /// <listheader>
152 /// <term>Attribute name</term>
153 /// <term>Value returned if not explicitly specified</term>
154 /// <term>Valid element types</term>
155 /// </listheader>
156 /// <item>
157 /// <description>checked</description>
158 /// <description>checked</description>
159 /// <description>Check Box</description>
160 /// </item>
161 /// <item>
162 /// <description>selected</description>
163 /// <description>selected</description>
164 /// <description>Options in Select elements</description>
165 /// </item>
166 /// <item>
167 /// <description>disabled</description>
168 /// <description>disabled</description>
169 /// <description>Input and other UI elements</description>
170 /// </item>
171 /// </list>
172 /// </remarks>
173 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
174 string GetAttribute(string attributeName);
175
176 /// <summary>
177 /// Gets the value of a declared HTML attribute of this element.
178 /// </summary>
179 /// <param name="attributeName">The name of the HTML attribute to get the value of.</param>
180 /// <returns>The HTML attribute's current value. Returns a <see langword="null"/> if the
181 /// value is not set or the declared attribute does not exist.</returns>
182 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
183 /// <remarks>
184 /// As opposed to the <see cref="GetAttribute(string)"/> method, this method
185 /// only returns attributes declared in the element's HTML markup. To access the value
186 /// of an IDL property of the element, either use the <see cref="GetAttribute(string)"/>
187 /// method or the <see cref="GetDomProperty(string)"/> method.
188 /// </remarks>
189 string GetDomAttribute(string attributeName);
190
191 /// <summary>
192 /// Gets the value of a JavaScript property of this element.
193 /// </summary>
194 /// <param name="propertyName">The name of the JavaScript property to get the value of.</param>
195 /// <returns>The JavaScript property's current value. Returns a <see langword="null"/> if the
196 /// value is not set or the property does not exist.</returns>
197 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
198 string GetDomProperty(string propertyName);
199
200 /// <summary>
201 /// Gets the value of a CSS property of this element.
202 /// </summary>
203 /// <param name="propertyName">The name of the CSS property to get the value of.</param>
204 /// <returns>The value of the specified CSS property.</returns>
205 /// <remarks>The value returned by the <see cref="GetCssValue"/>
206 /// method is likely to be unpredictable in a cross-browser environment.
207 /// Color values should be returned as hex strings. For example, a
208 /// "background-color" property set as "green" in the HTML source, will
209 /// return "#008000" for its value.</remarks>
210 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
211 string GetCssValue(string propertyName);
212
213 /// <summary>
214 /// Gets the representation of an element's shadow root for accessing the shadow DOM of a web component.
215 /// </summary>
216 /// <exception cref="NoSuchShadowRootException">Thrown when this element does not have a shadow root.</exception>
217 /// <returns>A shadow root representation.</returns>
218 ISearchContext GetShadowRoot();
219 }
220 }