Class: Selenium::WebDriver::Manager
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Manager
- Defined in:
- lib/selenium/webdriver/common/manager.rb
Instance Method Summary collapse
-
#add_cookie(opts = {}) ⇒ Object
Add a cookie to the browser.
-
#all_cookies ⇒ Array<Hash>
Get all cookies.
-
#cookie_named(name) ⇒ Hash?
Get the cookie with the given name.
-
#delete_all_cookies ⇒ Object
Delete all cookies.
-
#delete_cookie(name) ⇒ Object
Delete the cookie with the given name.
-
#initialize(bridge) ⇒ Manager
constructor
private
A new instance of Manager.
- #timeouts ⇒ Object
- #window ⇒ Object
Constructor Details
#initialize(bridge) ⇒ Manager
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Manager.
27 28 29 |
# File 'lib/selenium/webdriver/common/manager.rb', line 27 def initialize(bridge) @bridge = bridge end |
Instance Method Details
#add_cookie(opts = {}) ⇒ Object
Add a cookie to the browser
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/selenium/webdriver/common/manager.rb', line 45 def (opts = {}) raise ArgumentError, 'name is required' unless opts[:name] raise ArgumentError, 'value is required' unless opts[:value] # NOTE: This is required because of https://bugs.chromium.org/p/chromedriver/issues/detail?id=3732 opts[:secure] ||= false same_site = opts.delete(:same_site) opts[:sameSite] = same_site if same_site http_only = opts.delete(:http_only) opts[:httpOnly] = http_only if http_only obj = opts.delete(:expires) opts[:expiry] = seconds_from(obj).to_int if obj @bridge. opts end |
#all_cookies ⇒ Array<Hash>
Get all cookies
99 100 101 |
# File 'lib/selenium/webdriver/common/manager.rb', line 99 def @bridge..map { || () } end |
#cookie_named(name) ⇒ Hash?
Get the cookie with the given name
71 72 73 |
# File 'lib/selenium/webdriver/common/manager.rb', line 71 def (name) (@bridge.(name)) end |
#delete_all_cookies ⇒ Object
Delete all cookies
89 90 91 |
# File 'lib/selenium/webdriver/common/manager.rb', line 89 def @bridge. end |
#delete_cookie(name) ⇒ Object
Delete the cookie with the given name
81 82 83 |
# File 'lib/selenium/webdriver/common/manager.rb', line 81 def (name) @bridge. name end |