Class: Capybara::Driver::SafariWatir
- Inherits:
-
Object
- Object
- Capybara::Driver::SafariWatir
- Defined in:
- lib/capybara/driver/safariwatir_driver.rb
Defined Under Namespace
Classes: Node
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#rack_server ⇒ Object
readonly
Returns the value of attribute rack_server.
Instance Method Summary collapse
- #body ⇒ Object
- #find(selector) ⇒ Object
-
#initialize(app) ⇒ SafariWatir
constructor
A new instance of SafariWatir.
- #visit(path) ⇒ Object
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
#app ⇒ Object (readonly)
Returns the value of attribute app.
29 30 31 |
# File 'lib/capybara/driver/safariwatir_driver.rb', line 29 def app @app end |
#rack_server ⇒ Object (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
#body ⇒ Object
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 |