@@ -26,15 +26,12 @@ namespace OpenQA.Selenium.Support.Events
26
26
/// </summary>
27
27
public class FindElementEventArgs : EventArgs
28
28
{
29
- private IWebDriver driver ;
30
- private IWebElement element ;
31
- private By method ;
32
-
33
29
/// <summary>
34
30
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
35
31
/// </summary>
36
32
/// <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>
38
35
public FindElementEventArgs ( IWebDriver driver , By method )
39
36
: this ( driver , null , method )
40
37
{
@@ -44,37 +41,29 @@ public FindElementEventArgs(IWebDriver driver, By method)
44
41
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
45
42
/// </summary>
46
43
/// <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>
48
45
/// <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 )
50
48
{
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 ) ) ;
54
52
}
55
53
56
54
/// <summary>
57
55
/// Gets the WebDriver instance used in finding elements.
58
56
/// </summary>
59
- public IWebDriver Driver
60
- {
61
- get { return this . driver ; }
62
- }
57
+ public IWebDriver Driver { get ; }
63
58
64
59
/// <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 .
66
61
/// </summary>
67
- public IWebElement Element
68
- {
69
- get { return this . element ; }
70
- }
62
+ public IWebElement ? Element { get ; }
71
63
72
64
/// <summary>
73
65
/// Gets the <see cref="By"/> object containing the method used to find elements.
74
66
/// </summary>
75
- public By FindMethod
76
- {
77
- get { return this . method ; }
78
- }
67
+ public By FindMethod { get ; }
79
68
}
80
69
}
0 commit comments