| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>Class WebElement </title> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <meta name="title" content="Class WebElement "> |
| |
| <meta name="description" content="A base class representing an HTML element on a page."> |
| <link rel="icon" href="../images/favicon.ico"> |
| <link rel="stylesheet" href="../public/docfx.min.css"> |
| <link rel="stylesheet" href="../public/main.css"> |
| <meta name="docfx:navrel" content="../toc.html"> |
| <meta name="docfx:tocrel" content="toc.html"> |
| |
| <meta name="docfx:rel" content="../"> |
| |
| |
| <meta name="docfx:docurl" content="https://github.com/SeleniumHQ/selenium/new/trunk/apiSpec/new?filename=OpenQA_Selenium_WebElement.md&value=---%0Auid%3A%20OpenQA.Selenium.WebElement%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A"> |
| <meta name="loc:inThisArticle" content="In this article"> |
| <meta name="loc:searchResultsCount" content="{count} results for "{query}""> |
| <meta name="loc:searchNoResults" content="No results for "{query}""> |
| <meta name="loc:tocFilter" content="Filter by title"> |
| <meta name="loc:nextArticle" content="Next"> |
| <meta name="loc:prevArticle" content="Previous"> |
| <meta name="loc:themeLight" content="Light"> |
| <meta name="loc:themeDark" content="Dark"> |
| <meta name="loc:themeAuto" content="Auto"> |
| <meta name="loc:changeTheme" content="Change theme"> |
| <meta name="loc:copy" content="Copy"> |
| <meta name="loc:downloadPdf" content="Download PDF"> |
| |
| <script type="module" src="./../public/docfx.min.js"></script> |
| |
| <script> |
| const theme = localStorage.getItem('theme') || 'auto' |
| document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme) |
| </script> |
| |
| </head> |
| |
| <body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference"> |
| <header class="bg-body border-bottom"> |
| <nav id="autocollapse" class="navbar navbar-expand-md" role="navigation"> |
| <div class="container-xxl flex-nowrap"> |
| <a class="navbar-brand" href="../index.html"> |
| <img id="logo" class="svg" src="../images/logo.svg" alt="Selenium .NET API"> |
| Selenium .NET API |
| </a> |
| <button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation"> |
| <i class="bi bi-three-dots"></i> |
| </button> |
| <div class="collapse navbar-collapse" id="navpanel"> |
| <div id="navbar"> |
| <form class="search" role="search" id="search"> |
| <i class="bi bi-search"></i> |
| <input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search"> |
| </form> |
| </div> |
| </div> |
| </div> |
| </nav> |
| </header> |
| |
| <main class="container-xxl"> |
| <div class="toc-offcanvas"> |
| <div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel"> |
| <div class="offcanvas-header"> |
| <h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5> |
| <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button> |
| </div> |
| <div class="offcanvas-body"> |
| <nav class="toc" id="toc"></nav> |
| </div> |
| </div> |
| </div> |
| |
| <div class="content"> |
| <div class="actionbar"> |
| <button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents"> |
| <i class="bi bi-list"></i> |
| </button> |
| |
| <nav id="breadcrumb"></nav> |
| </div> |
| |
| <article data-uid="OpenQA.Selenium.WebElement"> |
| |
| |
| |
| <h1 id="OpenQA_Selenium_WebElement" data-uid="OpenQA.Selenium.WebElement" class="text-break"> |
| Class WebElement <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L36"><i class="bi bi-code-slash"></i></a> |
| </h1> |
| |
| <div class="facts text-secondary"> |
| <dl><dt>Namespace</dt><dd><a class="xref" href="OpenQA.html">OpenQA</a>.<a class="xref" href="OpenQA.Selenium.html">Selenium</a></dd></dl> |
| <dl><dt>Assembly</dt><dd>WebDriver.dll</dd></dl> |
| </div> |
| |
| <div class="markdown summary"><p>A base class representing an HTML element on a page.</p> |
| </div> |
| <div class="markdown conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public class WebElement : IWebElement, ISearchContext, IFindsElement, IWrapsDriver, ILocatable, ITakesScreenshot</code></pre> |
| </div> |
| |
| |
| |
| |
| <dl class="typelist inheritance"> |
| <dt>Inheritance</dt> |
| <dd> |
| <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div> |
| <div><span class="xref">WebElement</span></div> |
| </dd> |
| </dl> |
| |
| <dl class="typelist implements"> |
| <dt>Implements</dt> |
| <dd> |
| <div><a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></div> |
| <div><a class="xref" href="OpenQA.Selenium.ISearchContext.html">ISearchContext</a></div> |
| <div><a class="xref" href="OpenQA.Selenium.Internal.IFindsElement.html">IFindsElement</a></div> |
| <div><a class="xref" href="OpenQA.Selenium.IWrapsDriver.html">IWrapsDriver</a></div> |
| <div><a class="xref" href="OpenQA.Selenium.ILocatable.html">ILocatable</a></div> |
| <div><a class="xref" href="OpenQA.Selenium.ITakesScreenshot.html">ITakesScreenshot</a></div> |
| </dd> |
| </dl> |
| |
| |
| <dl class="typelist inheritedMembers"> |
| <dt>Inherited Members</dt> |
| <dd> |
| <div> |
| <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a> |
| </div> |
| <div> |
| <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a> |
| </div> |
| <div> |
| <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a> |
| </div> |
| <div> |
| <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a> |
| </div> |
| </dd></dl> |
| |
| |
| |
| |
| |
| |
| <h2 class="section" id="constructors">Constructors |
| </h2> |
| |
| |
| <a id="OpenQA_Selenium_WebElement__ctor_" data-uid="OpenQA.Selenium.WebElement.#ctor*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement__ctor_OpenQA_Selenium_WebDriver_System_String_" data-uid="OpenQA.Selenium.WebElement.#ctor(OpenQA.Selenium.WebDriver,System.String)"> |
| WebElement(WebDriver, string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L51"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="OpenQA.Selenium.WebElement.html">WebElement</a> class.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public WebElement(WebDriver parentDriver, string id)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>parentDriver</code> <a class="xref" href="OpenQA.Selenium.WebDriver.html">WebDriver</a></dt> |
| <dd><p>The <a class="xref" href="OpenQA.Selenium.WebDriver.html">WebDriver</a> instance that is driving this element.</p> |
| </dd> |
| <dt><code>id</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The ID value provided to identify the element.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt> |
| <dd><p>If <code class="paramref">parentDriver</code> or <code class="paramref">id</code> are <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <h2 class="section" id="fields">Fields |
| </h2> |
| |
| |
| |
| <h3 id="OpenQA_Selenium_WebElement_ElementReferencePropertyName" data-uid="OpenQA.Selenium.WebElement.ElementReferencePropertyName"> |
| ElementReferencePropertyName |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L41"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>The property name that represents a web element in the wire protocol.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public const string ElementReferencePropertyName = "element-6066-11e4-a52e-4f735466cecf"</code></pre> |
| </div> |
| |
| |
| |
| |
| <h4 class="section">Field Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <h2 class="section" id="properties">Properties |
| </h2> |
| |
| |
| <a id="OpenQA_Selenium_WebElement_ComputedAccessibleLabel_" data-uid="OpenQA.Selenium.WebElement.ComputedAccessibleLabel*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_ComputedAccessibleLabel" data-uid="OpenQA.Selenium.WebElement.ComputedAccessibleLabel"> |
| ComputedAccessibleLabel |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L233"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the computed accessible label of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string ComputedAccessibleLabel { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_ComputedAccessibleRole_" data-uid="OpenQA.Selenium.WebElement.ComputedAccessibleRole*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_ComputedAccessibleRole" data-uid="OpenQA.Selenium.WebElement.ComputedAccessibleRole"> |
| ComputedAccessibleRole |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L250"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the computed ARIA role for this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string ComputedAccessibleRole { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Coordinates_" data-uid="OpenQA.Selenium.WebElement.Coordinates*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Coordinates" data-uid="OpenQA.Selenium.WebElement.Coordinates"> |
| Coordinates |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L273"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the coordinates identifying the location of this element using |
| various frames of reference.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual ICoordinates Coordinates { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.Interactions.Internal.ICoordinates.html">ICoordinates</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Displayed_" data-uid="OpenQA.Selenium.WebElement.Displayed*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Displayed" data-uid="OpenQA.Selenium.WebElement.Displayed"> |
| Displayed |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L198"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets a value indicating whether or not this element is displayed.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual bool Displayed { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Displayed_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>The <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_Displayed">Displayed</a> property avoids the problem |
| of having to parse an element's "style" attribute to determine |
| visibility of an element.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Enabled_" data-uid="OpenQA.Selenium.WebElement.Enabled*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Enabled" data-uid="OpenQA.Selenium.WebElement.Enabled"> |
| Enabled |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L110"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets a value indicating whether or not this element is enabled.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual bool Enabled { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Enabled_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>The <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_Enabled">Enabled</a> property will generally |
| return <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> for everything except explicitly disabled input elements.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Id_" data-uid="OpenQA.Selenium.WebElement.Id*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Id" data-uid="OpenQA.Selenium.WebElement.Id"> |
| Id |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L290"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the ID of the element</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">protected string Id { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Id_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>This property is internal to the WebDriver instance, and is |
| not intended to be used in your code. The element's ID has no meaning |
| outside of internal WebDriver usage, so it would be improper to scope |
| it as public. However, both subclasses of <a class="xref" href="OpenQA.Selenium.WebElement.html">WebElement</a> |
| and the parent driver hosting the element have a need to access the |
| internal element ID. Therefore, we have two properties returning the |
| same value, one scoped as internal, the other as protected.</p> |
| </div> |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Location_" data-uid="OpenQA.Selenium.WebElement.Location*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Location" data-uid="OpenQA.Selenium.WebElement.Location"> |
| Location |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L147"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a> object containing the coordinates of the upper-left corner |
| of this element relative to the upper-left corner of the page.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual Point Location { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_LocationOnScreenOnceScrolledIntoView_" data-uid="OpenQA.Selenium.WebElement.LocationOnScreenOnceScrolledIntoView*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_LocationOnScreenOnceScrolledIntoView" data-uid="OpenQA.Selenium.WebElement.LocationOnScreenOnceScrolledIntoView"> |
| LocationOnScreenOnceScrolledIntoView |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L216"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the point where the element would be when scrolled into view.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual Point LocationOnScreenOnceScrolledIntoView { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Selected_" data-uid="OpenQA.Selenium.WebElement.Selected*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Selected" data-uid="OpenQA.Selenium.WebElement.Selected"> |
| Selected |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L129"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets a value indicating whether or not this element is selected.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual bool Selected { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Selected_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>This operation only applies to input elements such as checkboxes, |
| options in a select element and radio buttons.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Size_" data-uid="OpenQA.Selenium.WebElement.Size*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Size" data-uid="OpenQA.Selenium.WebElement.Size"> |
| Size |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L171"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets a <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_Size">Size</a> object containing the height and width of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual Size Size { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.size">Size</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_TagName_" data-uid="OpenQA.Selenium.WebElement.TagName*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_TagName" data-uid="OpenQA.Selenium.WebElement.TagName"> |
| TagName |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L71"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the tag name of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string TagName { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_TagName_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>The <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_TagName">TagName</a> property returns the tag name of the |
| element, not the value of the name attribute. For example, it will return |
| "input" for an element specified by the HTML markup <input name="foo" />.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Text_" data-uid="OpenQA.Selenium.WebElement.Text*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Text" data-uid="OpenQA.Selenium.WebElement.Text"> |
| Text |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L90"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the innerText of this element, without any leading or trailing whitespace, |
| and with other whitespace collapsed.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string Text { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_WrappedDriver_" data-uid="OpenQA.Selenium.WebElement.WrappedDriver*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_WrappedDriver" data-uid="OpenQA.Selenium.WebElement.WrappedDriver"> |
| WrappedDriver |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L60"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the <a class="xref" href="OpenQA.Selenium.IWebDriver.html">IWebDriver</a> driving this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public IWebDriver WrappedDriver { get; }</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| <h4 class="section">Property Value</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.IWebDriver.html">IWebDriver</a></dt> |
| <dd></dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <h2 class="section" id="methods">Methods |
| </h2> |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Clear_" data-uid="OpenQA.Selenium.WebElement.Clear*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Clear" data-uid="OpenQA.Selenium.WebElement.Clear"> |
| Clear() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L299"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Clears the content of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual void Clear()</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Clear_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>If this element is a text entry element, the <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_Clear">Clear()</a> |
| method will clear the value. It has no effect on other elements. Text entry elements |
| are defined as elements with INPUT or TEXTAREA tags.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Click_" data-uid="OpenQA.Selenium.WebElement.Click*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Click" data-uid="OpenQA.Selenium.WebElement.Click"> |
| Click() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L320"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Clicks this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual void Click()</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Click_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>Click this element. If the click causes a new page to load, the <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_Click">Click()</a> |
| method will attempt to block until the page has loaded. After calling the |
| <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_Click">Click()</a> method, you should discard all references to this |
| element unless you know that the element and the page will still be present. |
| Otherwise, any further operations performed on this element will have an undefined |
| behavior.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.InvalidElementStateException.html">InvalidElementStateException</a></dt> |
| <dd><p>Thrown when the target element is not enabled.</p> |
| </dd> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Equals_" data-uid="OpenQA.Selenium.WebElement.Equals*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Equals_System_Object_" data-uid="OpenQA.Selenium.WebElement.Equals(System.Object)"> |
| Equals(object?) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L659"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Compares if two elements are equal</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public override bool Equals(object? obj)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>obj</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></dt> |
| <dd><p>Object to compare against</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt> |
| <dd><p>A boolean if it is equal or not</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Execute_" data-uid="OpenQA.Selenium.WebElement.Execute*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Execute_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__" data-uid="OpenQA.Selenium.WebElement.Execute(System.String,System.Collections.Generic.Dictionary{System.String,System.Object})"> |
| Execute(string, Dictionary<string, object>?) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L700"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Executes a command on this element using the specified parameters.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">protected virtual Response Execute(string commandToExecute, Dictionary<string, object>? parameters)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>commandToExecute</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The <a class="xref" href="OpenQA.Selenium.DriverCommand.html">DriverCommand</a> to execute against this element.</p> |
| </dd> |
| <dt><code>parameters</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2">Dictionary</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>></dt> |
| <dd><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2">Dictionary<TKey, TValue></a> containing names and values of the parameters for the command.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.Response.html">Response</a></dt> |
| <dd><p>The <a class="xref" href="OpenQA.Selenium.Response.html">Response</a> object containing the result of the command execution.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_FindElement_" data-uid="OpenQA.Selenium.WebElement.FindElement*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_FindElement_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.WebElement.FindElement(OpenQA.Selenium.By)"> |
| FindElement(By) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L335"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Finds the first <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a> using the given method.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual IWebElement FindElement(By by)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>by</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt> |
| <dd><p>The locating mechanism to use.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt> |
| <dd><p>The first matching <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a> on the current context.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt> |
| <dd><p>If <code class="paramref">by</code> is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>.</p> |
| </dd> |
| <dt><a class="xref" href="OpenQA.Selenium.NoSuchElementException.html">NoSuchElementException</a></dt> |
| <dd><p>If no element matches the criteria.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_FindElement_" data-uid="OpenQA.Selenium.WebElement.FindElement*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_FindElement_System_String_System_String_" data-uid="OpenQA.Selenium.WebElement.FindElement(System.String,System.String)"> |
| FindElement(string, string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L351"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Finds a child element matching the given mechanism and value.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual IWebElement FindElement(string mechanism, string value)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>mechanism</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The mechanism by which to find the element.</p> |
| </dd> |
| <dt><code>value</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The value to use to search for the element.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt> |
| <dd><p>The first <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a> matching the given criteria.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_FindElements_" data-uid="OpenQA.Selenium.WebElement.FindElements*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_FindElements_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.WebElement.FindElements(OpenQA.Selenium.By)"> |
| FindElements(By) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L370"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Finds all <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElements</a> within the current context |
| using the given mechanism.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual ReadOnlyCollection<IWebElement> FindElements(By by)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>by</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt> |
| <dd><p>The locating mechanism to use.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.readonlycollection-1">ReadOnlyCollection</a><<a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a>></dt> |
| <dd><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.readonlycollection-1">ReadOnlyCollection<T></a> of all <a class="xref" href="OpenQA.Selenium.IWebElement.html">WebElements</a> |
| matching the current criteria, or an empty list if nothing matches.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_FindElements_" data-uid="OpenQA.Selenium.WebElement.FindElements*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_FindElements_System_String_System_String_" data-uid="OpenQA.Selenium.WebElement.FindElements(System.String,System.String)"> |
| FindElements(string, string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L386"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Finds all child elements matching the given mechanism and value.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual ReadOnlyCollection<IWebElement> FindElements(string mechanism, string value)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>mechanism</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The mechanism by which to find the elements.</p> |
| </dd> |
| <dt><code>value</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The value to use to search for the elements.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.readonlycollection-1">ReadOnlyCollection</a><<a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a>></dt> |
| <dd><p>A collection of all of the <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElements</a> matching the given criteria.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetAttribute_" data-uid="OpenQA.Selenium.WebElement.GetAttribute*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetAttribute_System_String_" data-uid="OpenQA.Selenium.WebElement.GetAttribute(System.String)"> |
| GetAttribute(string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L435"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the value of the specified attribute or property for this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string? GetAttribute(string attributeName)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>attributeName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The name of the attribute or property.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The attribute's or property's current value. Returns a <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> |
| if the value is not set.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_GetAttribute_System_String__remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>The <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_GetAttribute_System_String_">GetAttribute(string)</a> method will return the current value |
| of the attribute or property, even if the value has been modified after the page |
| has been loaded. Note that the value of the following attributes will be returned |
| even if there is no explicit attribute on the element: |
| <table><thead><tr><th class="term">Attribute name</th><th class="term">Value returned if not explicitly specified</th><th class="term">Valid element types</th></tr></thead><tbody><tr><td class="description">checked</td><td class="description">checked</td><td class="description">Check Box</td></tr><tr><td class="description">selected</td><td class="description">selected</td><td class="description">Options in Select elements</td></tr><tr><td class="description">disabled</td><td class="description">disabled</td><td class="description">Input and other UI elements</td></tr></tbody></table> |
| The method looks both in declared attributes in the HTML markup of the page, and |
| in the properties of the element as found when accessing the element's properties |
| via JavaScript. |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetCssValue_" data-uid="OpenQA.Selenium.WebElement.GetCssValue*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetCssValue_System_String_" data-uid="OpenQA.Selenium.WebElement.GetCssValue(System.String)"> |
| GetCssValue(string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L532"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the value of a CSS property of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string GetCssValue(string propertyName)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>propertyName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The name of the CSS property to get the value of.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The value of the specified CSS property.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_GetCssValue_System_String__remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>The value returned by the <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_GetCssValue_System_String_">GetCssValue(string)</a> |
| method is likely to be unpredictable in a cross-browser environment. |
| Color values should be returned as hex strings. For example, a |
| "background-color" property set as "green" in the HTML source, will |
| return "#008000" for its value.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetDomAttribute_" data-uid="OpenQA.Selenium.WebElement.GetDomAttribute*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetDomAttribute_System_String_" data-uid="OpenQA.Selenium.WebElement.GetDomAttribute(System.String)"> |
| GetDomAttribute(string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L467"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the value of a declared HTML attribute of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string? GetDomAttribute(string attributeName)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>attributeName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The name of the HTML attribute to get the value of.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The HTML attribute's current value. Returns a <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> if the |
| value is not set or the declared attribute does not exist.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_GetDomAttribute_System_String__remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>As opposed to the <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_GetAttribute_System_String_">GetAttribute(string)</a> method, this method |
| only returns attributes declared in the element's HTML markup. To access the value |
| of an IDL property of the element, either use the <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_GetAttribute_System_String_">GetAttribute(string)</a> |
| method or the <a class="xref" href="OpenQA.Selenium.WebElement.html#OpenQA_Selenium_WebElement_GetDomProperty_System_String_">GetDomProperty(string)</a> method.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetDomProperty_" data-uid="OpenQA.Selenium.WebElement.GetDomProperty*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetDomProperty_System_String_" data-uid="OpenQA.Selenium.WebElement.GetDomProperty(System.String)"> |
| GetDomProperty(string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L485"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the value of a JavaScript property of this element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual string? GetDomProperty(string propertyName)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>propertyName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The name of the JavaScript property to get the value of.</p> |
| </dd> |
| </dl> |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The JavaScript property's current value. Returns a <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> if the |
| value is not set or the property does not exist.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetHashCode_" data-uid="OpenQA.Selenium.WebElement.GetHashCode*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetHashCode" data-uid="OpenQA.Selenium.WebElement.GetHashCode"> |
| GetHashCode() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L649"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Method to get the hash code of the element</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public override int GetHashCode()</code></pre> |
| </div> |
| |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt> |
| <dd><p>Integer of the hash code for the element</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetScreenshot_" data-uid="OpenQA.Selenium.WebElement.GetScreenshot*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetScreenshot" data-uid="OpenQA.Selenium.WebElement.GetScreenshot"> |
| GetScreenshot() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L548"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets a <a class="xref" href="OpenQA.Selenium.Screenshot.html">Screenshot</a> object representing the image of this element on the screen.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual Screenshot GetScreenshot()</code></pre> |
| </div> |
| |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.Screenshot.html">Screenshot</a></dt> |
| <dd><p>A <a class="xref" href="OpenQA.Selenium.Screenshot.html">Screenshot</a> object containing the image.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_GetShadowRoot_" data-uid="OpenQA.Selenium.WebElement.GetShadowRoot*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_GetShadowRoot" data-uid="OpenQA.Selenium.WebElement.GetShadowRoot"> |
| GetShadowRoot() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L502"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Gets the representation of an element's shadow root for accessing the shadow DOM of a web component.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual ISearchContext GetShadowRoot()</code></pre> |
| </div> |
| |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.ISearchContext.html">ISearchContext</a></dt> |
| <dd><p>A shadow root representation.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| <dt><a class="xref" href="OpenQA.Selenium.NoSuchShadowRootException.html">NoSuchShadowRootException</a></dt> |
| <dd><p>Thrown when this element does not have a shadow root.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_SendKeys_" data-uid="OpenQA.Selenium.WebElement.SendKeys*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_SendKeys_System_String_" data-uid="OpenQA.Selenium.WebElement.SendKeys(System.String)"> |
| SendKeys(string) |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L573"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Simulates typing text into the element.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual void SendKeys(string text)</code></pre> |
| </div> |
| |
| <h4 class="section">Parameters</h4> |
| <dl class="parameters"> |
| <dt><code>text</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>The text to type into the element.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_SendKeys_System_String__remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>The text to be typed may include special characters like arrow keys, |
| backspaces, function keys, and so on. Valid special keys are defined in |
| <a class="xref" href="OpenQA.Selenium.Keys.html">Keys</a>.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.InvalidElementStateException.html">InvalidElementStateException</a></dt> |
| <dd><p>Thrown when the target element is not enabled.</p> |
| </dd> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| <dl class="typelist seealso"> |
| <dt>See Also</dt> |
| <dd> |
| <div><a class="xref" href="OpenQA.Selenium.Keys.html">Keys</a></div> |
| </dd> |
| </dl> |
| |
| |
| <a id="OpenQA_Selenium_WebElement_Submit_" data-uid="OpenQA.Selenium.WebElement.Submit*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_Submit" data-uid="OpenQA.Selenium.WebElement.Submit"> |
| Submit() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L613"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Submits this element to the web server.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public virtual void Submit()</code></pre> |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <h4 class="section" id="OpenQA_Selenium_WebElement_Submit_remarks">Remarks</h4> |
| <div class="markdown level1 remarks"><p>If this current element is a form, or an element within a form, |
| then this will be submitted to the web server. If this causes the current |
| page to change, then this method will attempt to block until the new page |
| is loaded.</p> |
| </div> |
| |
| <h4 class="section">Exceptions</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="OpenQA.Selenium.StaleElementReferenceException.html">StaleElementReferenceException</a></dt> |
| <dd><p>Thrown when the target element is no longer valid in the document DOM.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| <a id="OpenQA_Selenium_WebElement_ToString_" data-uid="OpenQA.Selenium.WebElement.ToString*"></a> |
| |
| <h3 id="OpenQA_Selenium_WebElement_ToString" data-uid="OpenQA.Selenium.WebElement.ToString"> |
| ToString() |
| <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L640"><i class="bi bi-code-slash"></i></a> |
| </h3> |
| |
| <div class="markdown level1 summary"><p>Returns a string that represents the current <a class="xref" href="OpenQA.Selenium.WebElement.html">WebElement</a>.</p> |
| </div> |
| <div class="markdown level1 conceptual"></div> |
| |
| <div class="codewrapper"> |
| <pre><code class="lang-csharp hljs">public override string ToString()</code></pre> |
| </div> |
| |
| |
| <h4 class="section">Returns</h4> |
| <dl class="parameters"> |
| <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt> |
| <dd><p>A string that represents the current <a class="xref" href="OpenQA.Selenium.WebElement.html">WebElement</a>.</p> |
| </dd> |
| </dl> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </article> |
| |
| <div class="contribution d-print-none"> |
| <a href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/WebElement.cs/#L36" class="edit-link">Edit this page</a> |
| </div> |
| |
| |
| </div> |
| |
| <div class="affix"> |
| <nav id="affix"></nav> |
| </div> |
| </main> |
| |
| <div class="container-xxl search-results" id="search-results"></div> |
| |
| <footer class="border-top text-secondary"> |
| <div class="container-xxl"> |
| <div class="flex-fill"> |
| <span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span> |
| </div> |
| </div> |
| </footer> |
| </body> |
| </html> |