File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
lib/selenium/webdriver/remote
spec/integration/selenium/webdriver Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,8 @@ def add_cookie(cookie)
385385 end
386386
387387 def delete_cookie ( name )
388+ raise ArgumentError , 'Cookie name cannot be null or empty' if name . nil? || name . strip . empty?
389+
388390 execute :delete_cookie , name : name
389391 end
390392
Original file line number Diff line number Diff line change @@ -253,6 +253,16 @@ module WebDriver
253253 expect { driver . manage . cookie_named ( 'non-existent' ) }
254254 . to raise_exception ( Error ::NoSuchCookieError )
255255 end
256+
257+ it 'throws an error when cookie name is an empty string' do
258+ expect { driver . manage . delete_cookie ( '' ) }
259+ . to raise_error ( ArgumentError , /Cookie name cannot be null or empty/ )
260+ end
261+
262+ it 'throws an error when cookie name is nil' do
263+ expect { driver . manage . delete_cookie ( nil ) }
264+ . to raise_error ( ArgumentError , /Cookie name cannot be null or empty/ )
265+ end
256266 end
257267 end # Options
258268 end # WebDriver
You can’t perform that action at this time.
0 commit comments