Skip to content

Commit eed2c13

Browse files
committed
Add fix made by Pallavi
1 parent 9af3d6e commit eed2c13

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

rb/lib/selenium/webdriver/remote/bridge.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

rb/spec/integration/selenium/webdriver/manager_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)