Class: Selenium::WebDriver::Chromium::Options
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Selenium::WebDriver::Options
|
Defined in: | rb/lib/selenium/webdriver/chromium/options.rb |
Constant Summary
-
CAPABILITIES =
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 27
{args: 'args', binary: 'binary', local_state: 'localState', prefs: 'prefs', detach: 'detach', debugger_address: 'debuggerAddress', exclude_switches: 'excludeSwitches', minidump_path: 'minidumpPath', emulation: 'mobileEmulation', perf_logging_prefs: 'perfLoggingPrefs', window_types: 'windowTypes', android_package: 'androidPackage', android_activity: 'androidActivity', android_device_serial: 'androidDeviceSerial', android_use_running_app: 'androidUseRunningApp'}.freeze
::Selenium::WebDriver::Options
- Inherited
Class Attribute Summary
::Selenium::WebDriver::Options
- Inherited
Class Method Summary
-
.new(profile: nil, **opts) ⇒ Options
constructor
Create a new
Options
instance.
::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
-
#extensions
rw
NOTE: special handling of ‘extensions’ to validate when set instead of when used.
-
#extensions=(extensions)
rw
Add an extension by local path.
- #logging_prefs rw
- #profile rw
::Selenium::WebDriver::Options
- Inherited
Instance Method Summary
-
#add_argument(arg)
Add a command-line argument to use when starting
::Selenium::WebDriver::Chrome
. -
#add_emulation(**opts)
Add emulation device information.
-
#add_encoded_extension(encoded)
Add an extension by Base64-encoded string.
-
#add_extension(path)
Add an extension by local path.
-
#add_preference(name, value)
Add a preference that is only applied to the user profile in use.
-
#enable_android(package: 'com.android.chrome', serial_number: nil, use_running_app: nil, activity: nil)
Enables mobile browser use on Android.
::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(profile: nil, **opts) ⇒ Options
Create a new Options
instance.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 70
def initialize(profile: nil, **opts) super(**opts) @profile = profile @options = {args: [], prefs: {}, emulation: {}, extensions: [], local_state: {}, exclude_switches: [], perf_logging_prefs: {}, window_types: []}.merge(@options) @logging_prefs = .delete(:logging_prefs) || {} @encoded_extensions = @options.delete(:encoded_extensions) || [] @extensions = [] @options.delete(:extensions).each { |ext| validate_extension(ext) } end
Instance Attribute Details
#extensions (rw)
NOTE: special handling of ‘extensions’ to validate when set instead of when used
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 44
attr_reader :extensions
#extensions=(extensions) (rw)
Add an extension by local path.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 115
def extensions=(extensions) extensions.each { |ext| validate_extension(ext) } end
#logging_prefs (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 24
attr_accessor :profile, :logging_prefs
#profile (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 24
attr_accessor :profile, :logging_prefs
Instance Method Details
#add_argument(arg)
Add a command-line argument to use when starting ::Selenium::WebDriver::Chrome
.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 143
def add_argument(arg) @options[:args] << arg end
#add_emulation(**opts)
Add emulation device information
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 181
def add_emulation(**opts) @options[:emulation] = opts end
#add_encoded_extension(encoded)
Add an extension by Base64-encoded string.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 129
def add_encoded_extension(encoded) @encoded_extensions << encoded end
#add_extension(path)
Add an extension by local path.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 100
def add_extension(path) validate_extension(path) end
#add_preference(name, value)
Add a preference that is only applied to the user profile in use.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 158
def add_preference(name, value) @options[:prefs][name] = value end
#enable_android(package: 'com.android.chrome', serial_number: nil, use_running_app: nil, activity: nil)
Enables mobile browser use on Android.
# File 'rb/lib/selenium/webdriver/chromium/options.rb', line 197
def enable_android(package: 'com.android.chrome', serial_number: nil, use_running_app: nil, activity: nil) @options[:android_package] = package @options[:android_activity] = activity unless activity.nil? @options[:android_device_serial] = serial_number unless serial_number.nil? @options[:android_use_running_app] = use_running_app unless use_running_app.nil? end