Class: Selenium::WebDriver::Firefox::Options
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Selenium::WebDriver::Options
|
Defined in: | rb/lib/selenium/webdriver/firefox/options.rb |
Constant Summary
-
BROWSER =
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 38'firefox'
-
CAPABILITIES =
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 29
{binary: 'binary', args: 'args', log: 'log', prefs: 'prefs', env: 'env', android_package: 'androidPackage', android_activity: 'androidActivity', android_device_serial: 'androidDeviceSerial', android_intent_arguments: 'androidIntentArguments'}.freeze
-
KEY =
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 26'moz:firefoxOptions'
::Selenium::WebDriver::Options
- Inherited
Class Attribute Summary
::Selenium::WebDriver::Options
- Inherited
Class Method Summary
-
.new(log_level: nil, **opts) ⇒ Options
constructor
Create a new
Options
instance, only for W3C-capable versions of::Selenium::WebDriver::Firefox
.
::Selenium::WebDriver::Options
- Inherited
.chrome, .edge, .firefox, .ie, | |
.internet_explorer | Alias for Options.ie. |
.microsoftedge | Alias for Options.edge. |
.new, .safari, .set_capabilities |
Instance Attribute Summary
- #debugger_address rw
- #log_level rw
- #log_level=(level) rw
-
#profile
rw
NOTE: special handling of ‘profile’ to validate when set instead of when used.
-
#profile=(profile)
rw
Sets Firefox profile.
::Selenium::WebDriver::Options
- Inherited
Instance Method Summary
-
#add_argument(arg)
Add a command-line argument to use when starting
::Selenium::WebDriver::Firefox
. -
#add_preference(name, value)
Add a preference that is only applied to the user profile in use.
-
#enable_android(package: 'org.mozilla.firefox', serial_number: nil, activity: nil, intent_arguments: nil)
Enables mobile browser use on Android.
- #camelize?(key) ⇒ Boolean private
- #process_browser_options(browser_options) private
- #process_profile(profile) private
::Selenium::WebDriver::Options
- Inherited
#==, | |
#add_option | Add a new option not yet handled by bindings. |
#eql? | Alias for Options#==. |
#camel_case, #camelize?, #convert_json_key, #generate_as_json, #process_browser_options, #process_json_hash, #process_w3c_options, #w3c?, #as_json |
Constructor Details
.new(log_level: nil, **opts) ⇒ Options
Create a new Options
instance, only for W3C-capable versions of ::Selenium::WebDriver::Firefox
.
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 59
def initialize(log_level: nil, **opts) @debugger_address = opts.delete(:debugger_address) { true } opts[:accept_insecure_certs] = true unless opts.key?(:accept_insecure_certs) super(**opts) @options[:args] ||= [] @options[:prefs] ||= {} # Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it. # https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/. @options[:prefs]['remote.active-protocols'] = 3 @options[:env] ||= {} @options[:log] ||= {level: log_level} if log_level process_profile(@options.delete(:profile)) end
Instance Attribute Details
#debugger_address (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 24
attr_accessor :debugger_address
#log_level (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 124
def log_level @options.dig(:log, :level) end
#log_level=(level) (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 128
def log_level=(level) @options[:log] = {level: level} end
#profile (rw)
NOTE: special handling of ‘profile’ to validate when set instead of when used
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 41
attr_reader :profile
#profile=(profile) (rw)
Sets Firefox profile.
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 120
def profile=(profile) process_profile(profile) end
Instance Method Details
#add_argument(arg)
Add a command-line argument to use when starting ::Selenium::WebDriver::Firefox
.
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 86
def add_argument(arg) @options[:args] << arg end
#add_preference(name, value)
Add a preference that is only applied to the user profile in use.
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 101
def add_preference(name, value) @options[:prefs][name] = value end
#camelize?(key) ⇒ Boolean
(private)
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 171
def camelize?(key) key != 'prefs' end
#enable_android(package: 'org.mozilla.firefox', serial_number: nil, activity: nil, intent_arguments: nil)
Enables mobile browser use on Android.
# File 'rb/lib/selenium/webdriver/firefox/options.rb', line 144
def enable_android(package: 'org.mozilla.firefox', serial_number: nil, activity: nil, intent_arguments: nil) @options[:android_package] = package @options[:android_activity] = activity unless activity.nil? @options[:android_device_serial] = serial_number unless serial_number.nil? @options[:android_intent_arguments] = intent_arguments unless intent_arguments.nil? end