Class: Selenium::WebDriver::SocketPoller

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/socket_poller.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port, timeout = 0, interval = 0.25) ⇒ SocketPoller

Returns a new instance of SocketPoller.



7
8
9
10
11
12
# File 'lib/selenium/webdriver/common/socket_poller.rb', line 7

def initialize(host, port, timeout = 0, interval = 0.25)
  @host     = host
  @port     = Integer(port)
  @timeout  = Integer(timeout)
  @interval = interval
end

Instance Method Details

#success?Boolean

Returns true if the socket can be connected to.

Returns:

  • (Boolean)

    true if the socket can be connected to



18
19
20
21
22
23
24
25
26
27
# File 'lib/selenium/webdriver/common/socket_poller.rb', line 18

def success?
  max_time = Time.now + @timeout

  (
    return true if can_connect?
    wait
  ) until Time.now >= max_time

  false
end