Class: Selenium::WebDriver::ServiceManager Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::ServiceManager
- Defined in:
- rb/lib/selenium/webdriver/common/service_manager.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class implementing default behavior of service_manager object, responsible for starting and stopping driver implementations.
Constant Summary collapse
- START_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
20
- SOCKET_LOCK_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
45
- STOP_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
20
Instance Method Summary collapse
-
#initialize(config) ⇒ ServiceManager
constructor
private
End users should use a class method for the desired driver, rather than using this directly.
- #start ⇒ Object private
- #stop ⇒ Object private
- #uri ⇒ Object private
Constructor Details
#initialize(config) ⇒ ServiceManager
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.
End users should use a class method for the desired driver, rather than using this directly.
39 40 41 42 43 44 45 46 47 48 |
# File 'rb/lib/selenium/webdriver/common/service_manager.rb', line 39 def initialize(config) @executable_path = config.executable_path @host = Platform.localhost @port = config.port @io = config.log @extra_args = config.args @shutdown_supported = config.shutdown_supported raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1 end |
Instance Method Details
#start ⇒ 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.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'rb/lib/selenium/webdriver/common/service_manager.rb', line 50 def start raise "already started: #{uri.inspect} #{@executable_path.inspect}" if process_running? Platform.exit_hook { stop } # make sure we don't leave the server running socket_lock.locked do find_free_port start_process connect_until_stable end end |
#stop ⇒ 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.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'rb/lib/selenium/webdriver/common/service_manager.rb', line 62 def stop return unless @shutdown_supported return if process_exited? stop_server @process.poll_for_exit STOP_TIMEOUT rescue ChildProcess::TimeoutError, Errno::ECONNREFUSED nil # noop ensure stop_process end |
#uri ⇒ 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.
74 75 76 |
# File 'rb/lib/selenium/webdriver/common/service_manager.rb', line 74 def uri @uri ||= URI.parse("http://#{@host}:#{@port}") end |