Class: Selenium::WebDriver::Service
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | rb/lib/selenium/webdriver/common/service.rb |
Overview
Base class implementing default behavior of service object, responsible for storing a service manager configuration.
Class Attribute Summary
Class Method Summary
- .chrome(**opts)
- .edge(**opts) (also: .microsoftedge, .msedge)
- .firefox(**opts)
- .ie(**opts) (also: .internet_explorer)
-
.internet_explorer(**opts)
Alias for .ie.
-
.microsoftedge(**opts)
Alias for .edge.
-
.msedge(**opts)
Alias for .edge.
- .safari(**opts)
-
.new(path: nil, port: nil, log: nil, args: nil) ⇒ Service
constructor
Internal use only
Internal use only
End users should use a class method for the desired driver, rather than using this directly.
Instance Attribute Summary
- #args (also: #extra_args) rw
- #executable_path rw
-
#extra_args
readonly
Alias for #args.
- #host rw
- #log rw
- #port rw
Instance Method Summary
Constructor Details
.new(path: nil, port: nil, log: nil, args: nil) ⇒ Service
This method is for internal use only.
End users should use a class method for the desired driver, rather than using this directly.
# File 'rb/lib/selenium/webdriver/common/service.rb', line 69
def initialize(path: nil, port: nil, log: nil, args: nil) port ||= self.class::DEFAULT_PORT args ||= [] path ||= env_path @executable_path = path @host = Platform.localhost @port = Integer(port) @log = case log when :stdout $stdout when :stderr $stderr else log end @args = args raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1 end
Class Attribute Details
.driver_path (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 29
attr_reader :driver_path
.driver_path=(path) (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 54
def driver_path=(path) Platform.assert_executable path if path.is_a?(String) @driver_path = path end
Class Method Details
.chrome(**opts)
[ GitHub ].edge(**opts) Also known as: .microsoftedge, .msedge
[ GitHub ].firefox(**opts)
[ GitHub ].ie(**opts) Also known as: .internet_explorer
[ GitHub ].internet_explorer(**opts)
Alias for .ie.
# File 'rb/lib/selenium/webdriver/common/service.rb', line 42
alias internet_explorer ie
.microsoftedge(**opts)
Alias for .edge.
# File 'rb/lib/selenium/webdriver/common/service.rb', line 47
alias microsoftedge edge
.msedge(**opts)
Alias for .edge.
# File 'rb/lib/selenium/webdriver/common/service.rb', line 48
alias msedge edge
.safari(**opts)
[ GitHub ]Instance Attribute Details
#args (rw) Also known as: #extra_args
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 60
attr_accessor :host, :executable_path, :port, :log, :args
#executable_path (rw)
[ GitHub ]#extra_args (readonly)
Alias for #args.
# File 'rb/lib/selenium/webdriver/common/service.rb', line 61
alias extra_args args
#host (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 60
attr_accessor :host, :executable_path, :port, :log, :args
#log (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 60
attr_accessor :host, :executable_path, :port, :log, :args
#port (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 60
attr_accessor :host, :executable_path, :port, :log, :args
Instance Method Details
#env_path
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 104
def env_path ENV.fetch(self.class::DRIVER_PATH_ENV_KEY, nil) end
#find_driver_path
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 99
def find_driver_path = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new DriverFinder.new(, self).driver_path end
#launch
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 90
def launch @executable_path ||= env_path || find_driver_path ServiceManager.new(self).tap(&:start) end
#shutdown_supported
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/service.rb', line 95
def shutdown_supported self.class::SHUTDOWN_SUPPORTED end