Class: Selenium::WebDriver::Firefox::Options
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Firefox::Options
- Defined in:
- lib/selenium/webdriver/firefox/options.rb
Constant Summary collapse
- KEY =
'moz:firefoxOptions'.freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#binary ⇒ Object
Returns the value of attribute binary.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#prefs ⇒ Object
readonly
Returns the value of attribute prefs.
-
#profile ⇒ Object
Returns the value of attribute profile.
Instance Method Summary collapse
-
#add_argument(arg) ⇒ Object
Add a command-line argument to use when starting Firefox.
-
#add_option(name, value) ⇒ Object
Add a new option not yet handled by these bindings.
-
#add_preference(name, value) ⇒ Object
Add a preference that is only applied to the user profile in use.
- #as_json ⇒ Object private
-
#initialize(**opts) ⇒ Options
constructor
Create a new Options instance, only for W3C-capable versions of Firefox.
Constructor Details
#initialize(**opts) ⇒ Options
Create a new Options instance, only for W3C-capable versions of Firefox.
45 46 47 48 49 50 51 52 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 45 def initialize(**opts) @args = opts.delete(:args) || [] @binary = opts.delete(:binary) @profile = opts.delete(:profile) @log_level = opts.delete(:log_level) @prefs = opts.delete(:prefs) || {} @options = opts.delete(:options) || {} end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args
24 25 26 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 24 def args @args end |
#binary ⇒ Object
Returns the value of attribute binary
25 26 27 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 25 def binary @binary end |
#log_level ⇒ Object
Returns the value of attribute log_level
25 26 27 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 25 def log_level @log_level end |
#options ⇒ Object (readonly)
Returns the value of attribute options
24 25 26 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 24 def @options end |
#prefs ⇒ Object (readonly)
Returns the value of attribute prefs
24 25 26 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 24 def prefs @prefs end |
#profile ⇒ Object
Returns the value of attribute profile
24 25 26 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 24 def profile @profile end |
Instance Method Details
#add_argument(arg) ⇒ Object
Add a command-line argument to use when starting Firefox.
64 65 66 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 64 def add_argument(arg) @args << arg end |
#add_option(name, value) ⇒ Object
Add a new option not yet handled by these bindings.
79 80 81 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 79 def add_option(name, value) @options[name] = value end |
#add_preference(name, value) ⇒ Object
Add a preference that is only applied to the user profile in use.
94 95 96 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 94 def add_preference(name, value) prefs[name] = value end |
#as_json ⇒ 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.
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/selenium/webdriver/firefox/options.rb', line 125 def as_json(*) opts = @options opts[:profile] = @profile.encoded if @profile opts[:args] = @args if @args.any? opts[:binary] = @binary if @binary opts[:prefs] = @prefs unless @prefs.empty? opts[:log] = {level: @log_level} if @log_level {KEY => opts} end |