Class: Watir::Capabilities
- Inherits:
-
Object
- Object
- Watir::Capabilities
- Defined in:
- lib/watir/capabilities.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#selenium_args ⇒ Object
readonly
Returns the value of attribute selenium_args.
-
#selenium_browser ⇒ Object
readonly
Returns the value of attribute selenium_browser.
Instance Method Summary collapse
-
#initialize(browser = nil, options = {}) ⇒ Capabilities
constructor
A new instance of Capabilities.
- #to_args ⇒ Object
Constructor Details
#initialize(browser = nil, options = {}) ⇒ Capabilities
Returns a new instance of Capabilities.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/watir/capabilities.rb', line 7 def initialize(browser = nil, = {}) @options, @browser = case browser when Selenium::WebDriver::Driver return when ::Symbol, String [.dup, browser&.to_sym] when Hash [browser.dup, infer_browser(browser)] when nil [{}, infer_browser] else raise ArgumentError, "expected Driver, String, Symbol or Hash, but received: #{browser.class}" end @selenium_browser = @options.key?(:url) ? :remote : @browser end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/watir/capabilities.rb', line 5 def @options end |
#selenium_args ⇒ Object (readonly)
Returns the value of attribute selenium_args.
5 6 7 |
# File 'lib/watir/capabilities.rb', line 5 def selenium_args @selenium_args end |
#selenium_browser ⇒ Object (readonly)
Returns the value of attribute selenium_browser.
5 6 7 |
# File 'lib/watir/capabilities.rb', line 5 def selenium_browser @selenium_browser end |
Instance Method Details
#to_args ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/watir/capabilities.rb', line 26 def to_args Watir.logger.info "Creating Browser instance of #{@browser} with user provided options: #{@options.inspect}" @selenium_args = process_arguments raise ArgumentError, "#{@options} are unrecognized arguments for Browser constructor" unless @options.empty? Watir.logger.info "Selenium options generated by Watir: #{@selenium_args.inspect}" [@selenium_browser, @selenium_args] end |