File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
lib/selenium/webdriver/common
sig/lib/selenium/webdriver/common
spec/integration/selenium/webdriver Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def add_cookie(opts = {})
6565 # Get the cookie with the given name
6666 #
6767 # @param [String] name the name of the cookie
68- # @return [Hash, nil] the cookie, or nil if it wasn't found.
68+ # @return [Hash, nil] the cookie, or throws a NoSuchCookieError if it wasn't found.
6969 #
7070
7171 def cookie_named ( name )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ module Selenium
1111
1212 def add_cookie : (?Hash[Symbol, untyped ] opts) -> void
1313
14- def cookie_named : (String name) -> Hash[Symbol, untyped ]
14+ def cookie_named : (String name) -> ( Hash[Symbol, untyped ] | Error::NoSuchCookieError)
1515
1616 def delete_cookie : (String name) -> String
1717
@@ -33,7 +33,7 @@ module Selenium
3333
3434 def strip_port : (String str) -> String?
3535
36- def convert_cookie : (Hash[ String, untyped ] cookie ) -> Hash[Symbol, untyped ]
36+ def convert_cookie : (String) -> ( Hash[Symbol, untyped ] | Error::NoSuchCookieError)
3737 end
3838 end
3939end
Original file line number Diff line number Diff line change @@ -248,6 +248,11 @@ module WebDriver
248248 driver . manage . delete_all_cookies
249249 expect ( driver . manage . all_cookies ) . to be_empty
250250 end
251+
252+ it 'throws error when fetching non-existent cookie' do
253+ expect { driver . manage . cookie_named ( 'non-existent' ) }
254+ . to raise_exception ( Error ::NoSuchCookieError )
255+ end
251256 end
252257 end # Options
253258 end # WebDriver
You can’t perform that action at this time.
0 commit comments