Method: Selenium::Client::Base#initialize

Defined in:
lib/selenium/client/base.rb

#initialize(*args) ⇒ Object

Create a new client driver

Example:

Selenium::Client::Driver.new \

:host => "localhost",
:port => 4444,
:browser => "*firefox",
:timeout_in_seconds => 10,
:url => "http://localhost:3000",

You can also set the default javascript framework used for :wait_for AJAX and effects semantics (:prototype is the default value):

Selenium::Client::Driver.new \

:host => "localhost",
:port => 4444,
:browser => "*firefox",
:timeout_in_seconds => 10,
:url => "http://localhost:3000",
:javascript_framework => :jquery

You can also enables automatic highlighting of located elements by passing the highlight_located_element option, e.g.

Selenium::Client::Driver.new \

:host => "localhost",
:port => 4444,
:browser => "*firefox",
:highlight_located_element => true


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/selenium/client/base.rb', line 48

def initialize(*args)
  if args[0].kind_of?(Hash)
    options = args[0]
    @host = options[:host]
    @port = options[:port].to_i
    @browser_string = options[:browser]
    @browser_url = options[:url]
    @default_timeout_in_seconds = (options[:timeout_in_seconds] || 300).to_i
    @default_javascript_framework = options[:javascript_framework] || :prototype
    @highlight_located_element_by_default = options[:highlight_located_element] || false
  else
    @host = args[0]
    @port = args[1].to_i
    @browser_string = args[2]
    @browser_url = args[3]
    @default_timeout_in_seconds = (args[4] || 300).to_i
    @default_javascript_framework = :prototype
    @highlight_located_element_by_default = false
  end

  @extension_js = ""
  @session_id = nil
end