Class: Selenium::WebDriver::Options
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Options
- Defined in:
- lib/selenium/webdriver/common/options.rb
Direct Known Subclasses
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) ⇒ Options
constructor
private
A new instance of Options.
- #logs ⇒ Object
- #timeouts ⇒ Object
- #window ⇒ Object
Constructor Details
#initialize(bridge) ⇒ Options
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 Options.
27 28 29 |
# File 'lib/selenium/webdriver/common/options.rb', line 27 def initialize(bridge) @bridge = bridge end |
Instance Method Details
#add_cookie(opts = {}) ⇒ Object
Add a cookie to the browser
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/selenium/webdriver/common/options.rb', line 44 def (opts = {}) raise ArgumentError, 'name is required' unless opts[:name] raise ArgumentError, 'value is required' unless opts[:value] opts[:path] ||= '/' opts[:secure] ||= false obj = opts.delete(:expires) opts[:expiry] = seconds_from(obj).to_i if obj @bridge. opts end |
#all_cookies ⇒ Array<Hash>
Get all cookies
92 93 94 |
# File 'lib/selenium/webdriver/common/options.rb', line 92 def @bridge..map { || () } end |
#cookie_named(name) ⇒ Hash?
Get the cookie with the given name
64 65 66 |
# File 'lib/selenium/webdriver/common/options.rb', line 64 def (name) .find { |c| c[:name] == name } end |
#delete_all_cookies ⇒ Object
Delete all cookies
82 83 84 |
# File 'lib/selenium/webdriver/common/options.rb', line 82 def @bridge. end |
#delete_cookie(name) ⇒ Object
Delete the cookie with the given name
74 75 76 |
# File 'lib/selenium/webdriver/common/options.rb', line 74 def (name) @bridge. name end |
#logs ⇒ Object
104 105 106 |
# File 'lib/selenium/webdriver/common/options.rb', line 104 def logs @logs ||= Logs.new(@bridge) end |