A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://seleniumhq.github.io/selenium/docs/api/dotnet/webdriver/OpenQA.Selenium.WebElement.html below:

Class WebElement

Class WebElement
Namespace
OpenQA.Selenium
Assembly
WebDriver.dll

A base class representing an HTML element on a page.

public class WebElement : IWebElement, ISearchContext, IFindsElement, IWrapsDriver, ILocatable, ITakesScreenshot
Inheritance

WebElement

Implements
Inherited Members
Constructors WebElement(WebDriver, string)

Initializes a new instance of the WebElement class.

public WebElement(WebDriver parentDriver, string id)
Parameters
parentDriver WebDriver

The WebDriver instance that is driving this element.

id string

The ID value provided to identify the element.

Exceptions
ArgumentNullException

If parentDriver or id are null.

Fields ElementReferencePropertyName

The property name that represents a web element in the wire protocol.

public const string ElementReferencePropertyName = "element-6066-11e4-a52e-4f735466cecf"
Field Value
string
Properties ComputedAccessibleLabel

Gets the computed accessible label of this element.

public virtual string ComputedAccessibleLabel { get; }
Property Value
string
ComputedAccessibleRole

Gets the computed ARIA role for this element.

public virtual string ComputedAccessibleRole { get; }
Property Value
string
Coordinates

Gets the coordinates identifying the location of this element using various frames of reference.

public virtual ICoordinates Coordinates { get; }
Property Value
ICoordinates
Displayed

Gets a value indicating whether or not this element is displayed.

public virtual bool Displayed { get; }
Property Value
bool
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

Enabled

Gets a value indicating whether or not this element is enabled.

public virtual bool Enabled { get; }
Property Value
bool
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

Id

Gets the ID of the element

protected string Id { get; }
Property Value
string
Location

Gets a Point object containing the coordinates of the upper-left corner of this element relative to the upper-left corner of the page.

public virtual Point Location { get; }
Property Value
Point
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

LocationOnScreenOnceScrolledIntoView

Gets the point where the element would be when scrolled into view.

public virtual Point LocationOnScreenOnceScrolledIntoView { get; }
Property Value
Point
Selected

Gets a value indicating whether or not this element is selected.

public virtual bool Selected { get; }
Property Value
bool
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

Size

Gets a Size object containing the height and width of this element.

public virtual Size Size { get; }
Property Value
Size
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

TagName

Gets the tag name of this element.

public virtual string TagName { get; }
Property Value
string
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

Text

Gets the innerText of this element, without any leading or trailing whitespace, and with other whitespace collapsed.

public virtual string Text { get; }
Property Value
string
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

WrappedDriver

Gets the IWebDriver driving this element.

public IWebDriver WrappedDriver { get; }
Property Value
IWebDriver
Methods Clear()

Clears the content of this element.

public virtual void Clear()
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

Click()

Clicks this element.

public virtual void Click()
Exceptions
InvalidElementStateException

Thrown when the target element is not enabled.

StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

Equals(object?)

Compares if two elements are equal

public override bool Equals(object? obj)
Parameters
obj object

Object to compare against

Returns
bool

A boolean if it is equal or not

Execute(string, Dictionary<string, object>?)

Executes a command on this element using the specified parameters.

protected virtual Response Execute(string commandToExecute, Dictionary<string, object>? parameters)
Parameters
commandToExecute string

The DriverCommand to execute against this element.

parameters Dictionary<string, object>

A Dictionary<TKey, TValue> containing names and values of the parameters for the command.

Returns
Response

The Response object containing the result of the command execution.

FindElement(By)

Finds the first IWebElement using the given method.

public virtual IWebElement FindElement(By by)
Parameters
by By

The locating mechanism to use.

Returns
IWebElement

The first matching IWebElement on the current context.

Exceptions
ArgumentNullException

If by is null.

NoSuchElementException

If no element matches the criteria.

FindElement(string, string)

Finds a child element matching the given mechanism and value.

public virtual IWebElement FindElement(string mechanism, string value)
Parameters
mechanism string

The mechanism by which to find the element.

value string

The value to use to search for the element.

Returns
IWebElement

The first IWebElement matching the given criteria.

FindElements(By)

Finds all IWebElements within the current context using the given mechanism.

public virtual ReadOnlyCollection<IWebElement> FindElements(By by)
Parameters
by By

The locating mechanism to use.

Returns
ReadOnlyCollection<IWebElement>

A ReadOnlyCollection<T> of all WebElements matching the current criteria, or an empty list if nothing matches.

FindElements(string, string)

Finds all child elements matching the given mechanism and value.

public virtual ReadOnlyCollection<IWebElement> FindElements(string mechanism, string value)
Parameters
mechanism string

The mechanism by which to find the elements.

value string

The value to use to search for the elements.

Returns
ReadOnlyCollection<IWebElement>

A collection of all of the IWebElements matching the given criteria.

GetAttribute(string)

Gets the value of the specified attribute or property for this element.

public virtual string? GetAttribute(string attributeName)
Parameters
attributeName string

The name of the attribute or property.

Returns
string

The attribute's or property's current value. Returns a null if the value is not set.

Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

GetCssValue(string)

Gets the value of a CSS property of this element.

public virtual string GetCssValue(string propertyName)
Parameters
propertyName string

The name of the CSS property to get the value of.

Returns
string

The value of the specified CSS property.

Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

GetDomAttribute(string)

Gets the value of a declared HTML attribute of this element.

public virtual string? GetDomAttribute(string attributeName)
Parameters
attributeName string

The name of the HTML attribute to get the value of.

Returns
string

The HTML attribute's current value. Returns a null if the value is not set or the declared attribute does not exist.

Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

GetDomProperty(string)

Gets the value of a JavaScript property of this element.

public virtual string? GetDomProperty(string propertyName)
Parameters
propertyName string

The name of the JavaScript property to get the value of.

Returns
string

The JavaScript property's current value. Returns a null if the value is not set or the property does not exist.

Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

GetHashCode()

Method to get the hash code of the element

public override int GetHashCode()
Returns
int

Integer of the hash code for the element

GetScreenshot()

Gets a Screenshot object representing the image of this element on the screen.

public virtual Screenshot GetScreenshot()
Returns
Screenshot

A Screenshot object containing the image.

GetShadowRoot()

Gets the representation of an element's shadow root for accessing the shadow DOM of a web component.

public virtual ISearchContext GetShadowRoot()
Returns
ISearchContext

A shadow root representation.

Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

NoSuchShadowRootException

Thrown when this element does not have a shadow root.

SendKeys(string)

Simulates typing text into the element.

public virtual void SendKeys(string text)
Parameters
text string

The text to type into the element.

Exceptions
InvalidElementStateException

Thrown when the target element is not enabled.

StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

See Also
Submit()

Submits this element to the web server.

public virtual void Submit()
Exceptions
StaleElementReferenceException

Thrown when the target element is no longer valid in the document DOM.

ToString()

Returns a string that represents the current WebElement.

public override string ToString()
Returns
string

A string that represents the current WebElement.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4