blob: 6a9342f1bdf69c47af03589d3f4bcb1ce49e51d1 [file] [log] [blame] [edit]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class RelativeBy </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class RelativeBy ">
<meta name="description" content="Provides a mechanism for finding elements spatially relative to other elements.">
<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_RelativeBy.md&amp;value=---%0Auid%3A%20OpenQA.Selenium.RelativeBy%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%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 &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<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.RelativeBy">
<h1 id="OpenQA_Selenium_RelativeBy" data-uid="OpenQA.Selenium.RelativeBy" class="text-break">
Class RelativeBy <a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L31"><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>Provides a mechanism for finding elements spatially relative to other elements.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public sealed class RelativeBy : By</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><a class="xref" href="OpenQA.Selenium.By.html">By</a></div>
<div><span class="xref">RelativeBy</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_Mechanism">By.Mechanism</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_Criteria">By.Criteria</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_Id_System_String_">By.Id(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_LinkText_System_String_">By.LinkText(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_Name_System_String_">By.Name(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_XPath_System_String_">By.XPath(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_ClassName_System_String_">By.ClassName(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_PartialLinkText_System_String_">By.PartialLinkText(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_TagName_System_String_">By.TagName(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_CssSelector_System_String_">By.CssSelector(string)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_ToString">By.ToString()</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_Equals_System_Object_">By.Equals(object)</a>
</div>
<div>
<a class="xref" href="OpenQA.Selenium.By.html#OpenQA_Selenium_By_GetHashCode">By.GetHashCode()</a>
</div>
<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.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
</dd></dl>
<h2 class="section" id="methods">Methods
</h2>
<a id="OpenQA_Selenium_RelativeBy_Above_" data-uid="OpenQA.Selenium.RelativeBy.Above*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Above_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.RelativeBy.Above(OpenQA.Selenium.By)">
Above(By)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L144"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element above the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Above(By locator)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>locator</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt>
<dd><p>The locator describing the element to look above for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">locator</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Above_" data-uid="OpenQA.Selenium.RelativeBy.Above*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Above_OpenQA_Selenium_IWebElement_" data-uid="OpenQA.Selenium.RelativeBy.Above(OpenQA.Selenium.IWebElement)">
Above(IWebElement)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L128"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element above the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Above(IWebElement element)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>element</code> <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt>
<dd><p>The element to look above for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">element</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Below_" data-uid="OpenQA.Selenium.RelativeBy.Below*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Below_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.RelativeBy.Below(OpenQA.Selenium.By)">
Below(By)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L176"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element below the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Below(By locator)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>locator</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt>
<dd><p>The locator describing the element to look below for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">locator</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Below_" data-uid="OpenQA.Selenium.RelativeBy.Below*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Below_OpenQA_Selenium_IWebElement_" data-uid="OpenQA.Selenium.RelativeBy.Below(OpenQA.Selenium.IWebElement)">
Below(IWebElement)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L160"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element below the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Below(IWebElement element)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>element</code> <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt>
<dd><p>The element to look below for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">element</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_FindElement_" data-uid="OpenQA.Selenium.RelativeBy.FindElement*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_FindElement_OpenQA_Selenium_ISearchContext_" data-uid="OpenQA.Selenium.RelativeBy.FindElement(OpenQA.Selenium.ISearchContext)">
FindElement(ISearchContext)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L71"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Finds the first element matching the criteria.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override IWebElement FindElement(ISearchContext context)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>context</code> <a class="xref" href="OpenQA.Selenium.ISearchContext.html">ISearchContext</a></dt>
<dd><p>An <a class="xref" href="OpenQA.Selenium.ISearchContext.html">ISearchContext</a> object to use to search for the elements.</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.argumentexception">ArgumentException</a></dt>
<dd><p>If <code class="paramref">context</code> is not <a class="xref" href="OpenQA.Selenium.IJavaScriptExecutor.html">IJavaScriptExecutor</a> or wraps a driver that does.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_FindElements_" data-uid="OpenQA.Selenium.RelativeBy.FindElements*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_FindElements_OpenQA_Selenium_ISearchContext_" data-uid="OpenQA.Selenium.RelativeBy.FindElements(OpenQA.Selenium.ISearchContext)">
FindElements(ISearchContext)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L89"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Finds all elements matching the criteria.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override ReadOnlyCollection&lt;IWebElement&gt; FindElements(ISearchContext context)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>context</code> <a class="xref" href="OpenQA.Selenium.ISearchContext.html">ISearchContext</a></dt>
<dd><p>An <a class="xref" href="OpenQA.Selenium.ISearchContext.html">ISearchContext</a> object 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>&lt;<a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a>&gt;</dt>
<dd><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.readonlycollection-1">ReadOnlyCollection&lt;T&gt;</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>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>If <code class="paramref">context</code> is not <a class="xref" href="OpenQA.Selenium.IJavaScriptExecutor.html">IJavaScriptExecutor</a> or wraps a driver that does.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_LeftOf_" data-uid="OpenQA.Selenium.RelativeBy.LeftOf*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_LeftOf_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.RelativeBy.LeftOf(OpenQA.Selenium.By)">
LeftOf(By)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L208"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element to the left of the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy LeftOf(By locator)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>locator</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt>
<dd><p>The locator describing the element to look to the left of for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">locator</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_LeftOf_" data-uid="OpenQA.Selenium.RelativeBy.LeftOf*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_LeftOf_OpenQA_Selenium_IWebElement_" data-uid="OpenQA.Selenium.RelativeBy.LeftOf(OpenQA.Selenium.IWebElement)">
LeftOf(IWebElement)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L192"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element to the left of the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy LeftOf(IWebElement element)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>element</code> <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt>
<dd><p>The element to look to the left of for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">element</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Near_" data-uid="OpenQA.Selenium.RelativeBy.Near*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Near_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.RelativeBy.Near(OpenQA.Selenium.By)">
Near(By)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L280"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element near the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Near(By locator)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>locator</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt>
<dd><p>The locator describing the element to look near for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">locator</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Near_" data-uid="OpenQA.Selenium.RelativeBy.Near*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Near_OpenQA_Selenium_By_System_Int32_" data-uid="OpenQA.Selenium.RelativeBy.Near(OpenQA.Selenium.By,System.Int32)">
Near(By, int)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L293"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element near the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Near(By locator, int atMostDistanceInPixels)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>locator</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt>
<dd><p>The locator describing the element to look near for elements.</p>
</dd>
<dt><code>atMostDistanceInPixels</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The maximum distance from the element to be considered &quot;near.&quot;</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">locator</code> is null.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
<dd><p>If <code class="paramref">atMostDistanceInPixels</code> is not a positive value.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Near_" data-uid="OpenQA.Selenium.RelativeBy.Near*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Near_OpenQA_Selenium_IWebElement_" data-uid="OpenQA.Selenium.RelativeBy.Near(OpenQA.Selenium.IWebElement)">
Near(IWebElement)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L256"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element near the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Near(IWebElement element)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>element</code> <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt>
<dd><p>The element to look near for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">element</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_Near_" data-uid="OpenQA.Selenium.RelativeBy.Near*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_Near_OpenQA_Selenium_IWebElement_System_Int32_" data-uid="OpenQA.Selenium.RelativeBy.Near(OpenQA.Selenium.IWebElement,System.Int32)">
Near(IWebElement, int)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L269"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element near the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy Near(IWebElement element, int atMostDistanceInPixels)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>element</code> <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt>
<dd><p>The element to look near for elements.</p>
</dd>
<dt><code>atMostDistanceInPixels</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The maximum distance from the element to be considered &quot;near.&quot;</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">element</code> is null.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
<dd><p>If <code class="paramref">atMostDistanceInPixels</code> is not a positive value.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_RightOf_" data-uid="OpenQA.Selenium.RelativeBy.RightOf*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_RightOf_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.RelativeBy.RightOf(OpenQA.Selenium.By)">
RightOf(By)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L240"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element to the right of the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy RightOf(By locator)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>locator</code> <a class="xref" href="OpenQA.Selenium.By.html">By</a></dt>
<dd><p>The locator describing the element to look to the right of for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">locator</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_RightOf_" data-uid="OpenQA.Selenium.RelativeBy.RightOf*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_RightOf_OpenQA_Selenium_IWebElement_" data-uid="OpenQA.Selenium.RelativeBy.RightOf(OpenQA.Selenium.IWebElement)">
RightOf(IWebElement)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L224"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Locates an element to the right of the specified element.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RelativeBy RightOf(IWebElement element)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>element</code> <a class="xref" href="OpenQA.Selenium.IWebElement.html">IWebElement</a></dt>
<dd><p>The element to look to the right of for elements.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object for use in finding the elements.</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">element</code> is null.</p>
</dd>
</dl>
<a id="OpenQA_Selenium_RelativeBy_WithLocator_" data-uid="OpenQA.Selenium.RelativeBy.WithLocator*"></a>
<h3 id="OpenQA_Selenium_RelativeBy_WithLocator_OpenQA_Selenium_By_" data-uid="OpenQA.Selenium.RelativeBy.WithLocator(OpenQA.Selenium.By)">
WithLocator(By)
<a class="header-action link-secondary" title="View source" href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L60"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a new <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> for finding elements with the specified tag name.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static RelativeBy WithLocator(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>A By object that will be used to find the initial element.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a></dt>
<dd><p>A <a class="xref" href="OpenQA.Selenium.RelativeBy.html">RelativeBy</a> object to be used in finding the elements.</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 null.</p>
</dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs/#L31" 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>