@@ -70,6 +70,7 @@ private RelativeBy(object root, List<object> filters) : this()
70
70
/// </summary>
71
71
/// <param name="tagName">The tag name of the element to find.</param>
72
72
/// <returns>A <see cref="RelativeBy"/> object to be used in finding the elements.</returns>
73
+ [ Obsolete ( "Use the WithLocator method instead, passing By.TagName." ) ]
73
74
public static RelativeBy WithTagName ( string tagName )
74
75
{
75
76
if ( string . IsNullOrEmpty ( tagName ) )
@@ -80,6 +81,17 @@ public static RelativeBy WithTagName(string tagName)
80
81
return new RelativeBy ( By . TagName ( tagName ) ) ;
81
82
}
82
83
84
+ /// <summary>
85
+ /// Creates a new <see cref="RelativeBy"/> for finding elements with the specified tag name.
86
+ /// </summary>
87
+ /// <param name="by">A By object that will be used to find the initial element.</param>
88
+ /// <returns>A <see cref="RelativeBy"/> object to be used in finding the elements.</returns>
89
+ public static RelativeBy WithLocator ( By by )
90
+ {
91
+ return new RelativeBy ( by ) ;
92
+ }
93
+
94
+
83
95
/// <summary>
84
96
/// Finds the first element matching the criteria.
85
97
/// </summary>
@@ -111,7 +123,7 @@ public override ReadOnlyCollection<IWebElement> FindElements(ISearchContext cont
111
123
filterParameters [ "filters" ] = this . filters ;
112
124
parameters [ "relative" ] = filterParameters ;
113
125
object rawElements = js . ExecuteScript ( wrappedAtom , parameters ) ;
114
- ReadOnlyCollection < IWebElement > elements = rawElements as ReadOnlyCollection < IWebElement > ;
126
+ ReadOnlyCollection < IWebElement > elements = rawElements as ReadOnlyCollection < IWebElement > ;
115
127
return elements ;
116
128
}
117
129
0 commit comments