Class: Statt::Client

Inherits:
Selenium::Client::Driver
  • Object
show all
Defined in:
lib/statt/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



5
6
7
8
9
10
11
12
# File 'lib/statt/client.rb', line 5

def initialize(options = {})
  options = { :host => "localhost", 
              :port => 4444,
              :timeout => 300, 
              :browser => "*firefox",
              :url => "http://localhost:3000"}.merge(options)
  super(options)
end

Instance Method Details

#click_button_by_text(value) ⇒ Object



22
23
24
# File 'lib/statt/client.rb', line 22

def click_button_by_text(value)
  click "xpath=//input[@value='#{value}']"
end


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/statt/client.rb', line 26

def click_link_by_text(value)
  begin
    click "xpath=//a[text()='#{value}']"
  rescue Exception => msg
    begin
      click "xpath=//a/*[text()='#{value}']"
    rescue Exception => msg
      puts "Couldn\'t locate '#{value}' #{msg}"
    end
  end
end

#sourceObject



38
39
40
# File 'lib/statt/client.rb', line 38

def source
  
end

#startObject



14
15
16
# File 'lib/statt/client.rb', line 14

def start
  start_new_browser_session
end

#stopObject



18
19
20
# File 'lib/statt/client.rb', line 18

def stop
  close_current_browser_session
end