@@ -15,7 +15,7 @@ public interface IRenderedFragment
1515 /// Gets the <see cref="ITestContext"/> which this rendered fragment belongs to.
1616 /// </summary>
1717 ITestContext TestContext { get ; }
18-
18+
1919 /// <summary>
2020 /// Gets the HTML markup from the rendered fragment/component.
2121 /// </summary>
@@ -53,21 +53,29 @@ public interface IRenderedFragment
5353 void TakeSnapshot ( ) ;
5454
5555 /// <summary>
56- /// Returns the first element within the rendered fragment or component under test
57- /// ( using depth-first pre-order traversal of the document's nodes) that matches the
58- /// specified group of selectors .
56+ /// Returns the first element from the rendered fragment or component under test,
57+ /// using the provided <paramref name="cssSelector"/>, in a depth-first pre-order traversal
58+ /// of the rendered nodes .
5959 /// </summary>
60- /// <param name="selector">The group of selectors to use.</param>
61- public IElement Find ( string selector ) => GetNodes ( ) . QuerySelector ( selector ) ;
60+ /// <param name="cssSelector">The group of selectors to use.</param>
61+ public IElement Find ( string cssSelector )
62+ {
63+ var result = GetNodes ( ) . QuerySelector ( cssSelector ) ;
64+ if ( result is null )
65+ throw new ElementNotFoundException ( cssSelector ) ;
66+ else
67+ return result ;
68+ }
6269
6370 /// <summary>
64- /// Returns a list of the elements within the rendered fragment or component under test,
65- /// (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors.
71+ /// Returns a list of elements from the rendered fragment or component under test,
72+ /// using the provided <paramref name="cssSelector"/>, in a depth-first pre-order traversal
73+ /// of the rendered nodes.
6674 /// </summary>
67- /// <param name="selector ">The group of selectors to use.</param>
68- public IHtmlCollection < IElement > FindAll ( string selector )
75+ /// <param name="cssSelector ">The group of selectors to use.</param>
76+ public IHtmlCollection < IElement > FindAll ( string cssSelector )
6977 {
70- return GetNodes ( ) . QuerySelectorAll ( selector ) ;
78+ return GetNodes ( ) . QuerySelectorAll ( cssSelector ) ;
7179 }
7280 }
7381}
0 commit comments