Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added a method to query web elements with class name

  • Loading branch information...
commit ce7eab07228027df9cd6610559f14b08f97db47a 1 parent 6d394aa
@shashankshetty shashankshetty authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/FluentBrowserAutomation/BrowserContext.cs
View
11 src/FluentBrowserAutomation/BrowserContext.cs
@@ -29,6 +29,7 @@ public interface IBrowserContext
ContainerWrapper ContainerWithId([NotNull] string id);
DialogHandlerWrapper Dialog([NotNull] Action action);
DivWrapper DivWithId([NotNull] string id);
+ IEnumerable<IWebElement> GetWebElementsWithClassName([NotNull] string className);
IEnumerable<DivWrapper> Divs();
DropDownListWrapper DropDownListWithId([NotNull] string idOfList);
DropDownListWrapper DropDownListWithLabel([NotNull] string label);
@@ -172,6 +173,11 @@ public DivWrapper DivWithId(string id)
return new DivWrapper(div, String.Format(howFound, id), this);
}
+ public IEnumerable<IWebElement> GetWebElementsWithClassName(string className)
+ {
+ return TryGetElementsByClassName(className);
+ }
+
public IEnumerable<DivWrapper> Divs()
{
const string howFound = "type 'div'";
@@ -524,5 +530,10 @@ private IWebElement TryGetElementByIdAndTagType(string id, string tag)
{
return Browser.FindElements(By.Id(id)).FirstOrDefault(x => x.TagName == tag);
}
+
+ private IEnumerable<IWebElement> TryGetElementsByClassName(string className)
+ {
+ return Browser.FindElements(By.ClassName(className));
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.