Class: Selenium::WebDriver::Remote::Capabilities Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Remote::Capabilities
- Defined in:
- lib/selenium/webdriver/remote/capabilities.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Specification of the desired and/or actual capabilities of the browser that the server is being asked to create.
Instance Attribute Summary collapse
- #browser_name ⇒ Object private
- #css_selectors_enabled ⇒ Object (also: #css_selectors_enabled?) private
- #firefox_profile ⇒ Object private
- #javascript_enabled ⇒ Object (also: #javascript_enabled?) private
- #native_events ⇒ Object (also: #native_events?) private
- #platform ⇒ Object private
- #proxy ⇒ Object private
- #rotatable ⇒ Object (also: #rotatable?) private
- #takes_screenshot ⇒ Object (also: #takes_screenshot?) private
- #version ⇒ Object private
Class Method Summary collapse
- .android(opts = {}) ⇒ Object private
- .chrome(opts = {}) ⇒ Object private
- .firefox(opts = {}) ⇒ Object private
- .htmlunit(opts = {}) ⇒ Object private
- .internet_explorer(opts = {}) ⇒ Object (also: ie) private
- .iphone(opts = {}) ⇒ Object private
- .json_create(data) ⇒ Object private
- .opera(opts = {}) ⇒ Object private
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?) private
- #as_json(opts = nil) ⇒ Object private
-
#initialize(opts = {}) ⇒ Capabilities
constructor
Firefox-specific options:.
- #to_json(*args) ⇒ Object private
Constructor Details
#initialize(opts = {}) ⇒ Capabilities
Firefox-specific options:
125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 125 def initialize(opts = {}) @browser_name = opts[:browser_name] || "" @version = opts[:version] || "" @platform = opts[:platform] || :any @javascript_enabled = opts[:javascript_enabled] || false @css_selectors_enabled = opts[:css_selectors_enabled] || false @takes_screenshot = opts[:takes_screenshot] || false @native_events = opts[:native_events] || false @rotatable = opts[:rotatable] || false @firefox_profile = opts[:firefox_profile] self.proxy = opts[:proxy] end |
Instance Attribute Details
#browser_name ⇒ Object
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def browser_name @browser_name end |
#css_selectors_enabled ⇒ Object Also known as: css_selectors_enabled?
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def css_selectors_enabled @css_selectors_enabled end |
#firefox_profile ⇒ Object
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def firefox_profile @firefox_profile end |
#javascript_enabled ⇒ Object Also known as: javascript_enabled?
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def javascript_enabled @javascript_enabled end |
#native_events ⇒ Object Also known as: native_events?
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def native_events @native_events end |
#platform ⇒ Object
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def platform @platform end |
#proxy ⇒ Object
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.
10 11 12 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 10 def proxy @proxy end |
#rotatable ⇒ Object Also known as: rotatable?
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def rotatable @rotatable end |
#takes_screenshot ⇒ Object Also known as: takes_screenshot?
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def takes_screenshot @takes_screenshot end |
#version ⇒ Object
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.
12 13 14 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 12 def version @version end |
Class Method Details
.android(opts = {}) ⇒ Object
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.
33 34 35 36 37 38 39 40 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 33 def android(opts = {}) new({ :browser_name => "android", :platform => :android, :rotatable => true, :takes_screenshot => true }.merge(opts)) end |
.chrome(opts = {}) ⇒ Object
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.
42 43 44 45 46 47 48 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 42 def chrome(opts = {}) new({ :browser_name => "chrome", :javascript_enabled => true, :css_selectors_enabled => true }.merge(opts)) end |
.firefox(opts = {}) ⇒ Object
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.
50 51 52 53 54 55 56 57 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 50 def firefox(opts = {}) new({ :browser_name => "firefox", :javascript_enabled => true, :takes_screenshot => true, :css_selectors_enabled => true }.merge(opts)) end |
.htmlunit(opts = {}) ⇒ Object
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.
59 60 61 62 63 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 59 def htmlunit(opts = {}) new({ :browser_name => "htmlunit" }.merge(opts)) end |
.internet_explorer(opts = {}) ⇒ Object Also known as: ie
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.
65 66 67 68 69 70 71 72 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 65 def internet_explorer(opts = {}) new({ :browser_name => "internet explorer", :platform => :windows, :takes_screenshot => true, :css_selectors_enabled => true }.merge(opts)) end |
.iphone(opts = {}) ⇒ Object
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.
75 76 77 78 79 80 81 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 75 def iphone(opts = {}) new({ :browser_name => "iphone", :platform => :mac, :javascript_enabled => true }.merge(opts)) end |
.json_create(data) ⇒ Object
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.
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 94 def json_create(data) new( :browser_name => data["browserName"], :version => data["version"], :platform => data["platform"].downcase.to_sym, :javascript_enabled => data["javascriptEnabled"], :css_selectors_enabled => data["cssSelectorsEnabled"], :takes_screenshot => data["takesScreenshot"], :native_events => data["nativeEvents"], :rotatable => data["rotatable"], :proxy => (Proxy.json_create(data['proxy']) if data['proxy']) ) end |
.opera(opts = {}) ⇒ Object
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.
83 84 85 86 87 88 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 83 def opera(opts = {}) new({ :browser_name => "opera", :javascript_enabled => true }.merge(opts)) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
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.
175 176 177 178 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 175 def ==(other) return false unless other.kind_of? self.class as_json == other.as_json end |
#as_json(opts = nil) ⇒ Object
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.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 153 def as_json(opts = nil) hash = { "browserName" => browser_name, "version" => version, "platform" => platform.to_s.upcase, "javascriptEnabled" => javascript_enabled?, "cssSelectorsEnabled" => css_selectors_enabled?, "takesScreenshot" => takes_screenshot?, "nativeEvents" => native_events?, "rotatable" => rotatable?, } hash["proxy"] = proxy.as_json if proxy hash['firefox_profile'] = firefox_profile.as_json['zip'] if firefox_profile hash end |
#to_json(*args) ⇒ Object
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.
171 172 173 |
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 171 def to_json(*args) as_json.to_json(*args) end |