@@ -74,16 +74,16 @@ public void AddCookie(Cookie cookie)
7474 /// Delete the cookie by passing in the name of the cookie
7575 /// </summary>
7676 /// <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>
7878 public void DeleteCookieNamed ( string name )
7979 {
80- if ( name is null )
80+ if ( string . IsNullOrWhiteSpace ( name ) )
8181 {
82- throw new ArgumentNullException ( nameof ( name ) ) ;
82+ throw new ArgumentException ( "Cookie name cannot be null or empty" , nameof ( name ) ) ;
8383 }
8484
85- Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
86- parameters . Add ( "name" , name ) ;
85+ Dictionary < string , object > parameters = new ( ) { { "name" , name } } ;
86+
8787 driver . InternalExecute ( DriverCommand . DeleteCookie , parameters ) ;
8888 }
8989
@@ -115,11 +115,12 @@ public void DeleteAllCookies()
115115 /// </summary>
116116 /// <param name="name">name of the cookie that needs to be returned</param>
117117 /// <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>
118119 public Cookie ? GetCookieNamed ( string name )
119120 {
120121 if ( string . IsNullOrWhiteSpace ( name ) )
121122 {
122- throw new ArgumentException ( "Cookie name cannot be empty" , nameof ( name ) ) ;
123+ throw new ArgumentException ( "Cookie name cannot be null or empty" , nameof ( name ) ) ;
123124 }
124125
125126 try
0 commit comments