@@ -26,15 +26,12 @@ namespace OpenQA.Selenium.Support.Events
2626 /// </summary>
2727 public class FindElementEventArgs : EventArgs
2828 {
29- private IWebDriver driver ;
30- private IWebElement element ;
31- private By method ;
32-
3329 /// <summary>
3430 /// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
3531 /// </summary>
3632 /// <param name="driver">The WebDriver instance used in finding elements.</param>
37- /// <param name="method">The <see cref="By"/> object containing the method used to find elements</param>
33+ /// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
34+ /// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
3835 public FindElementEventArgs ( IWebDriver driver , By method )
3936 : this ( driver , null , method )
4037 {
@@ -44,37 +41,29 @@ public FindElementEventArgs(IWebDriver driver, By method)
4441 /// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
4542 /// </summary>
4643 /// <param name="driver">The WebDriver instance used in finding elements.</param>
47- /// <param name="element">The parent element used as the context for the search.</param>
44+ /// <param name="element">The parent element used as the context for the search, or <see langword="null"/> if none exists .</param>
4845 /// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
49- public FindElementEventArgs ( IWebDriver driver , IWebElement element , By method )
46+ /// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
47+ public FindElementEventArgs ( IWebDriver driver , IWebElement ? element , By method )
5048 {
51- this . driver = driver ;
52- this . element = element ;
53- this . method = method ;
49+ this . Driver = driver ?? throw new ArgumentNullException ( nameof ( driver ) ) ;
50+ this . Element = element ;
51+ this . FindMethod = method ?? throw new ArgumentNullException ( nameof ( method ) ) ;
5452 }
5553
5654 /// <summary>
5755 /// Gets the WebDriver instance used in finding elements.
5856 /// </summary>
59- public IWebDriver Driver
60- {
61- get { return this . driver ; }
62- }
57+ public IWebDriver Driver { get ; }
6358
6459 /// <summary>
65- /// Gets the parent element used as the context for the search.
60+ /// Gets the parent element used as the context for the search, or <see langword="null"/> if no element is associated .
6661 /// </summary>
67- public IWebElement Element
68- {
69- get { return this . element ; }
70- }
62+ public IWebElement ? Element { get ; }
7163
7264 /// <summary>
7365 /// Gets the <see cref="By"/> object containing the method used to find elements.
7466 /// </summary>
75- public By FindMethod
76- {
77- get { return this . method ; }
78- }
67+ public By FindMethod { get ; }
7968 }
8069}
0 commit comments