@@ -74,16 +74,16 @@ public void AddCookie(Cookie cookie)
74
74
/// Delete the cookie by passing in the name of the cookie
75
75
/// </summary>
76
76
/// <param name="name">The name of the cookie that is in the browser</param>
77
- /// <exception cref="ArgumentNullException ">If <paramref name="name"/> is <see langword="null"/>.</exception>
77
+ /// <exception cref="ArgumentException ">If <paramref name="name"/> is <see langword="null"/> or <see cref="string.Empty "/>.</exception>
78
78
public void DeleteCookieNamed ( string name )
79
79
{
80
- if ( name is null )
80
+ if ( string . IsNullOrWhiteSpace ( name ) )
81
81
{
82
- throw new ArgumentNullException ( nameof ( name ) ) ;
82
+ throw new ArgumentException ( "Cookie name cannot be null or empty" , nameof ( name ) ) ;
83
83
}
84
84
85
- Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
86
- parameters . Add ( "name" , name ) ;
85
+ Dictionary < string , object > parameters = new ( ) { { "name" , name } } ;
86
+
87
87
driver . InternalExecute ( DriverCommand . DeleteCookie , parameters ) ;
88
88
}
89
89
@@ -115,11 +115,12 @@ public void DeleteAllCookies()
115
115
/// </summary>
116
116
/// <param name="name">name of the cookie that needs to be returned</param>
117
117
/// <returns>A Cookie from the name; or <see langword="null"/> if not found.</returns>
118
+ /// <exception cref="ArgumentException">If <paramref name="name"/> is <see langword="null"/> or <see cref="string.Empty"/>.</exception>
118
119
public Cookie ? GetCookieNamed ( string name )
119
120
{
120
121
if ( string . IsNullOrWhiteSpace ( name ) )
121
122
{
122
- throw new ArgumentException ( "Cookie name cannot be empty" , nameof ( name ) ) ;
123
+ throw new ArgumentException ( "Cookie name cannot be null or empty" , nameof ( name ) ) ;
123
124
}
124
125
125
126
try
0 commit comments