@@ -39,6 +39,8 @@ public class FindByPrompt : FindStrategy
3939{
4040 private bool _tryResolveFromPages = true ;
4141
42+ private WindowsDriver WrappedDriver => ServicesCollection . Current . Resolve < WindowsDriver > ( ) ;
43+
4244 /// <summary>
4345 /// Initializes a new instance of the <see cref="FindByPrompt"/> class with the specified prompt value.
4446 /// </summary>
@@ -49,44 +51,24 @@ public FindByPrompt(string value, bool tryResolveFromPages = true) : base(value)
4951 _tryResolveFromPages = tryResolveFromPages ;
5052 }
5153
52- /// <summary>
53- /// Locates a single AppiumElement using the resolved XPath.
54- /// </summary>
55- public override AppiumElement FindElement ( WindowsDriver driver )
56- {
57- var location = driver . CurrentWindowHandle ;
58- var xpath = ResolveLocator ( location , driver ) ;
59- return driver . FindElement ( By . XPath ( xpath ) ) ;
60- }
61-
62- /// <summary>
63- /// Locates all matching AppiumElements using the resolved XPath.
64- /// </summary>
65- public override IEnumerable < AppiumElement > FindAllElements ( WindowsDriver driver )
66- {
67- var location = driver . CurrentWindowHandle ;
68- var xpath = ResolveLocator ( location , driver ) ;
69- return driver . FindElements ( By . XPath ( xpath ) ) ;
70- }
71-
7254 /// <summary>
7355 /// Locates a single AppiumElement in the context of a parent element using the resolved XPath.
7456 /// </summary>
75- public override AppiumElement FindElement ( AppiumElement element )
57+ public override AppiumElement FindElement ( ISearchContext searchContext )
7658 {
77- var location = element . WrappedDriver . CurrentWindowHandle ;
78- var xpath = ResolveLocator ( location , element . WrappedDriver as WindowsDriver ) ;
79- return element . FindElement ( By . XPath ( xpath ) ) ;
59+ var location = WrappedDriver . CurrentWindowHandle ;
60+ var xpath = ResolveLocator ( location , WrappedDriver as WindowsDriver ) ;
61+ return searchContext . FindElement ( By . XPath ( xpath ) ) as AppiumElement ;
8062 }
8163
8264 /// <summary>
8365 /// Locates all matching AppiumElements in the context of a parent element using the resolved XPath.
8466 /// </summary>
85- public override IEnumerable < AppiumElement > FindAllElements ( AppiumElement element )
67+ public override IEnumerable < AppiumElement > FindAllElements ( ISearchContext searchContext )
8668 {
87- var location = element . WrappedDriver . CurrentWindowHandle ;
88- var xpath = ResolveLocator ( location , element . WrappedDriver as WindowsDriver ) ;
89- return element . FindElements ( By . XPath ( xpath ) ) ;
69+ var location = WrappedDriver . CurrentWindowHandle ;
70+ var xpath = ResolveLocator ( location , WrappedDriver as WindowsDriver ) ;
71+ return searchContext . FindElements ( By . XPath ( xpath ) ) . Select ( el => el as AppiumElement ) ;
9072 }
9173
9274 /// <summary>
0 commit comments