@@ -29,16 +29,13 @@ namespace OpenQA.Selenium
2929 /// <summary>
3030 /// Provides a mechanism for finding elements spatially relative to other elements.
3131 /// </summary>
32- public class RelativeBy : By
32+ public sealed class RelativeBy : By
3333 {
3434 private readonly string wrappedAtom ;
3535 private readonly object root ;
3636 private readonly List < object > filters = new List < object > ( ) ;
3737
38- /// <summary>
39- /// Prevents a default instance of the <see cref="RelativeBy"/> class.
40- /// </summary>
41- protected RelativeBy ( ) : base ( )
38+ private static string GetWrappedAtom ( )
4239 {
4340 string atom ;
4441 using ( Stream atomStream = ResourceUtilities . GetResourceStream ( "find-elements.js" , "find-elements.js" ) )
@@ -49,13 +46,13 @@ protected RelativeBy() : base()
4946 }
5047 }
5148
52- wrappedAtom = string . Format ( CultureInfo . InvariantCulture , "/* findElements */return ({0}).apply(null, arguments);" , atom ) ;
49+ return string . Format ( CultureInfo . InvariantCulture , "/* findElements */return ({0}).apply(null, arguments);" , atom ) ;
5350 }
5451
55- private RelativeBy ( object root , List < object > ? filters = null ) : this ( )
52+ private RelativeBy ( object root , List < object > ? filters = null )
5653 {
54+ this . wrappedAtom = GetWrappedAtom ( ) ;
5755 this . root = GetSerializableRoot ( root ) ;
58-
5956 if ( filters != null )
6057 {
6158 this . filters . AddRange ( filters ) ;
@@ -73,7 +70,6 @@ public static RelativeBy WithLocator(By by)
7370 return new RelativeBy ( by ) ;
7471 }
7572
76-
7773 /// <summary>
7874 /// Finds the first element matching the criteria.
7975 /// </summary>
0 commit comments