Class: Selenium::WebDriver::Options
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Options
- Defined in:
- lib/selenium/webdriver/options.rb
Instance Method Summary collapse
-
#add_cookie(opts = {}) ⇒ Object
Add a cookie to the browser.
-
#all_cookies ⇒ Array<Hash>
Get all cookies.
-
#delete_all_cookies ⇒ Object
Delete all cookies.
-
#delete_cookie(name) ⇒ Object
Delete the cookie with the given name.
-
#initialize(driver) ⇒ Options
constructor
A new instance of Options.
- #speed ⇒ Object
- #speed=(speed) ⇒ Object
- #timeouts ⇒ Object
Constructor Details
#initialize(driver) ⇒ Options
Returns a new instance of Options.
9 10 11 |
# File 'lib/selenium/webdriver/options.rb', line 9 def initialize(driver) @bridge = driver.bridge end |
Instance Method Details
#add_cookie(opts = {}) ⇒ Object
Add a cookie to the browser
25 26 27 28 29 30 31 32 33 |
# File 'lib/selenium/webdriver/options.rb', line 25 def (opts = {}) raise ArgumentError, "name is required" unless opts[:name] raise ArgumentError, "value is required" unless opts[:value] opts[:path] ||= "/" opts[:secure] ||= false @bridge.addCookie opts end |
#all_cookies ⇒ Array<Hash>
Get all cookies
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/selenium/webdriver/options.rb', line 59 def @bridge.getAllCookies.map do || { :name => ["name"], :value => ["value"], :path => ["path"], :domain => ["domain"], :expires => ["expires"], :secure => ["secure"] } end end |
#delete_all_cookies ⇒ Object
Delete all cookies
49 50 51 |
# File 'lib/selenium/webdriver/options.rb', line 49 def @bridge.deleteAllCookies end |
#delete_cookie(name) ⇒ Object
Delete the cookie with the given name
41 42 43 |
# File 'lib/selenium/webdriver/options.rb', line 41 def (name) @bridge.deleteCookie name end |
#speed ⇒ Object
72 73 74 |
# File 'lib/selenium/webdriver/options.rb', line 72 def speed @bridge.getSpeed.downcase.to_sym end |
#speed=(speed) ⇒ Object
76 77 78 |
# File 'lib/selenium/webdriver/options.rb', line 76 def speed=(speed) @bridge.setSpeed(speed.to_s.upcase) end |