Object
@api private
# File lib/selenium/webdriver/chrome/service.rb, line 31 def self.default_service new executable_path, PortProber.random end
# File lib/selenium/webdriver/chrome/service.rb, line 16 def self.executable_path @executable_path ||= ( path = Platform.find_binary "chromedriver" path or raise Error::WebDriverError, MISSING_TEXT Platform.assert_executable path path ) end
# File lib/selenium/webdriver/chrome/service.rb, line 26 def self.executable_path=(path) Platform.assert_executable path @executable_path = path end
# File lib/selenium/webdriver/chrome/service.rb, line 35 def initialize(executable_path, port) @uri = URI.parse "http://#{Platform.localhost}:#{port}" server_command = [executable_path, "--port=#{port}"] @process = ChildProcess.build(*server_command) @socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT @process.io.inherit! if $DEBUG == true end
# File lib/selenium/webdriver/chrome/service.rb, line 45 def start @process.start unless @socket_poller.connected? raise Error::WebDriverError, "unable to connect to chromedriver #{@uri}" end Platform.exit_hook { stop } # make sure we don't leave the server running end
# File lib/selenium/webdriver/chrome/service.rb, line 55 def stop return if @process.nil? || @process.exited? Net::HTTP.get uri.host, '/shutdown', uri.port @process.poll_for_exit STOP_TIMEOUT rescue ChildProcess::TimeoutError # ok, force quit @process.stop STOP_TIMEOUT end
Generated with the Darkfish Rdoc Generator 2.