Class: Capybara::Driver::SafariWatir

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/driver/safariwatir_driver.rb

Defined Under Namespace

Classes: Node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ SafariWatir

Returns a new instance of SafariWatir.



31
32
33
34
35
# File 'lib/capybara/driver/safariwatir_driver.rb', line 31

def initialize(app)
  @app = app
  @rack_server = Capybara::Server.new(@app)
  @rack_server.boot
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



29
30
31
# File 'lib/capybara/driver/safariwatir_driver.rb', line 29

def app
  @app
end

#rack_serverObject (readonly)

Returns the value of attribute rack_server.



29
30
31
# File 'lib/capybara/driver/safariwatir_driver.rb', line 29

def rack_server
  @rack_server
end

Instance Method Details

#bodyObject



41
42
43
# File 'lib/capybara/driver/safariwatir_driver.rb', line 41

def body
  browser.html
end

#find(selector) ⇒ Object



45
46
47
48
49
# File 'lib/capybara/driver/safariwatir_driver.rb', line 45

def find(selector)
  foo = Struct.new(:what).new
  foo.what = selector
  browser.send(:scripter).operate_by_xpath(foo){}.map { |node| Node.new(node) }
end

#visit(path) ⇒ Object



37
38
39
# File 'lib/capybara/driver/safariwatir_driver.rb', line 37

def visit(path)
  browser.goto(url(path))
end