Class: Selenium::WebDriver::Options
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Options
- Defined in:
- lib/selenium/webdriver/common/options.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) ⇒ Options
constructor
A new instance of Options.
- #speed ⇒ Object
- #speed=(speed) ⇒ Object
- #timeouts ⇒ Object
Constructor Details
#initialize(bridge) ⇒ Options
Returns a new instance of Options.
9 10 11 |
# File 'lib/selenium/webdriver/common/options.rb', line 9 def initialize(bridge) @bridge = bridge end |
Instance Method Details
#add_cookie(opts = {}) ⇒ Object
Add a cookie to the browser
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/selenium/webdriver/common/options.rb', line 26 def (opts = {}) raise ArgumentError, "name is required" unless opts[:name] raise ArgumentError, "value is required" unless opts[:value] opts[:path] ||= "/" opts[:secure] ||= false if obj = opts[:expires] opts[:expiry] = seconds_from(obj) end @bridge.addCookie opts end |
#all_cookies ⇒ Array<Hash>
Get all cookies
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/selenium/webdriver/common/options.rb', line 76 def @bridge.getAllCookies.map do || { :name => ["name"], :value => ["value"], :path => ["path"], :domain => strip_port(["domain"]), :expires => ["expiry"] && datetime_at(['expiry']), :secure => ["secure"] } end end |
#cookie_named(name) ⇒ Hash?
Get the cookie with the given name
48 49 50 |
# File 'lib/selenium/webdriver/common/options.rb', line 48 def (name) .find { |c| c[:name] == name } end |
#delete_all_cookies ⇒ Object
Delete all cookies
66 67 68 |
# File 'lib/selenium/webdriver/common/options.rb', line 66 def @bridge.deleteAllCookies end |
#delete_cookie(name) ⇒ Object
Delete the cookie with the given name
58 59 60 |
# File 'lib/selenium/webdriver/common/options.rb', line 58 def (name) @bridge.deleteCookie name end |
#speed ⇒ Object
89 90 91 |
# File 'lib/selenium/webdriver/common/options.rb', line 89 def speed @bridge.getSpeed.downcase.to_sym end |
#speed=(speed) ⇒ Object
93 94 95 |
# File 'lib/selenium/webdriver/common/options.rb', line 93 def speed=(speed) @bridge.setSpeed(speed.to_s.upcase) end |