Skip to content

Commit 46b5adc

Browse files
tomashercegcafour
authored andcommitted
Fixed incompatibility with new Selenium packages
1 parent 74987d7 commit 46b5adc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Core/Riganti.Selenium.Core/SelectBy.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public SelectBy(string selectMethodName)
2121
}
2222
SelectBy by = new SelectBy("SelectBy.CssSelector");
2323
by.FindElementMethod =
24-
(ISearchContext context) => ((IFindsByCssSelector)context).FindElementByCssSelector(cssSelectorToFind);
24+
(ISearchContext context) => context.FindElement(By.CssSelector(cssSelectorToFind));
2525
by.FindElementsMethod =
26-
(ISearchContext context) => ((IFindsByCssSelector)context).FindElementsByCssSelector(cssSelectorToFind);
26+
(ISearchContext context) => context.FindElements(By.CssSelector(cssSelectorToFind));
2727
by.Value = cssSelectorToFind;
2828
return by;
2929
}
@@ -41,8 +41,8 @@ public static SelectBy CssSelector(string cssSelectorToFind, string formatString
4141
var fullSelector = string.IsNullOrWhiteSpace(formatString) ? cssSelectorToFind : string.Format(formatString, cssSelectorToFind);
4242
SelectBy by = new SelectBy("SelectBy.CssSelector");
4343
by.FormatString = formatString;
44-
by.FindElementMethod = (ISearchContext context) => ((IFindsByCssSelector)context).FindElementByCssSelector(fullSelector);
45-
by.FindElementsMethod = (ISearchContext context) => ((IFindsByCssSelector)context).FindElementsByCssSelector(fullSelector);
44+
by.FindElementMethod = (ISearchContext context) => context.FindElement(By.CssSelector(fullSelector));
45+
by.FindElementsMethod = (ISearchContext context) => context.FindElements(By.CssSelector(fullSelector));
4646
by.Value = fullSelector;
4747
return by;
4848
}
@@ -58,8 +58,8 @@ public static SelectBy CssSelector(string cssSelectorToFind, string formatString
5858
throw new ArgumentNullException("tagNameToFind", "Cannot find elements when name tag name is null.");
5959
}
6060
SelectBy by = new SelectBy("SelectBy.TagName");
61-
by.FindElementMethod = (ISearchContext context) => ((IFindsByTagName)context).FindElementByTagName(tagNameToFind);
62-
by.FindElementsMethod = (ISearchContext context) => ((IFindsByTagName)context).FindElementsByTagName(tagNameToFind);
61+
by.FindElementMethod = (ISearchContext context) => context.FindElement(By.TagName(tagNameToFind));
62+
by.FindElementsMethod = (ISearchContext context) => context.FindElements(By.TagName(tagNameToFind));
6363
by.Value = tagNameToFind;
6464
return by;
6565
}

0 commit comments

Comments
 (0)