Skip to content

Commit

Permalink
Merge pull request #6 from techartdev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
techartdev authored May 23, 2023
2 parents f406fcb + e07bc0d commit 4c2a101
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 4c2a101

Please sign in to comment.