Class: Selenium::WebDriver::IE::Server

Inherits:
Object
  • Object
show all
Defined in:
rb/lib/selenium/webdriver/ie/server.rb

Constant Summary

STOP_TIMEOUT =
5

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Server) initialize(binary_path, opts = {})

Returns a new instance of Server



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 20

def initialize(binary_path, opts = {})
  Platform.assert_executable binary_path

  @binary_path = binary_path
  @process = nil

  opts = opts.dup
  @log_level   = opts.delete(:log_level)
  @log_file    = opts.delete(:log_file)

  unless opts.empty?
    raise ArgumentError, "invalid option#{'s' if opts.size != 1}: #{opts.inspect}"
  end

end

Instance Attribute Details

- (Object) log_file

Returns the value of attribute log_file



18
19
20
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 18

def log_file
  @log_file
end

- (Object) log_level

Returns the value of attribute log_level



18
19
20
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 18

def log_level
  @log_level
end

Class Method Details

+ (Object) get



8
9
10
11
12
13
14
15
16
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 8

def self.get
  binary = IE.driver_path || Platform.find_binary("IEDriverServer")
  if binary
    new(binary)
  else
    raise Error::WebDriverError,
      "Unable to find standalone executable. Please download the IEDriverServer from http://code.google.com/p/selenium/downloads/list and place the executable on your PATH."
  end
end

Instance Method Details

- (Object) port



60
61
62
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 60

def port
  @port
end

- (Boolean) running?

Returns:

  • (Boolean)


68
69
70
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 68

def running?
  @process && @process.alive?
end

- (Object) start(port, timeout)



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 36

def start(port, timeout)
  return @port if running?

  @port = port

  @process = ChildProcess.new(@binary_path, *server_args)
  @process.io.inherit! if $DEBUG
  @process.start

  unless SocketPoller.new(Platform.localhost, @port, timeout).connected?
    raise Error::WebDriverError, "unable to connect to IE server within #{timeout} seconds"
  end

  Platform.exit_hook { stop }

  @port
end

- (Object) stop



54
55
56
57
58
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 54

def stop
  if running?
    @process.stop STOP_TIMEOUT
  end
end

- (Object) uri



64
65
66
# File 'rb/lib/selenium/webdriver/ie/server.rb', line 64

def uri
  "http://#{Platform.localhost}:#{port}"
end