Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageTags>selenium;extensions;sibling;parent</PackageTags>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions Selenium.WebDriver.SimpleExtensions/WebElementExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Xml.Linq;

namespace Selenium.WebDriver.SimpleExtensions
{
Expand All @@ -26,6 +27,11 @@ public static IWebElement GetSiblingByIndex(this IWebElement e, int index)
return e.FindElement(By.XPath($"following-sibling::*[{index}]"));
}

public static IReadOnlyCollection<IWebElement> GetSiblings(this IWebElement e)
{
return e.FindElements(By.XPath("./following-sibling::* | ./preceding-sibling::*"));
}

public static IWebElement GetFirstChild(this IWebElement e)
{
return e.FindElement(By.XPath("child::*[1]"));
Expand Down