Class: Capybara::Driver::Celerity
- Inherits:
-
Base
- Object
- Base
- Capybara::Driver::Celerity
show all
- Defined in:
- lib/capybara/driver/celerity_driver.rb
Defined Under Namespace
Classes: Node
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#has_shortcircuit_timeout?, #wait_until, #within_frame, #within_window
Constructor Details
#initialize(app, options = {}) ⇒ Celerity
Returns a new instance of Celerity.
99
100
101
102
103
104
|
# File 'lib/capybara/driver/celerity_driver.rb', line 99
def initialize(app, options={})
@app = app
@options = options
@rack_server = Capybara::Server.new(@app)
@rack_server.boot if Capybara.run_server
end
|
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
97
98
99
|
# File 'lib/capybara/driver/celerity_driver.rb', line 97
def app
@app
end
|
#options ⇒ Object
Returns the value of attribute options.
97
98
99
|
# File 'lib/capybara/driver/celerity_driver.rb', line 97
def options
@options
end
|
#rack_server ⇒ Object
Returns the value of attribute rack_server.
97
98
99
|
# File 'lib/capybara/driver/celerity_driver.rb', line 97
def rack_server
@rack_server
end
|
Instance Method Details
#body ⇒ Object
118
119
120
|
# File 'lib/capybara/driver/celerity_driver.rb', line 118
def body
browser.document.as_xml
end
|
#browser ⇒ Object
145
146
147
148
149
150
151
152
|
# File 'lib/capybara/driver/celerity_driver.rb', line 145
def browser
unless @_browser
require 'celerity'
@_browser = ::Celerity::Browser.new(options)
end
@_browser
end
|
#current_url ⇒ Object
110
111
112
|
# File 'lib/capybara/driver/celerity_driver.rb', line 110
def current_url
browser.url
end
|
#evaluate_script(script) ⇒ Object
141
142
143
|
# File 'lib/capybara/driver/celerity_driver.rb', line 141
def evaluate_script(script)
browser.execute_script "#{script}"
end
|
#execute_script(script) ⇒ Object
136
137
138
139
|
# File 'lib/capybara/driver/celerity_driver.rb', line 136
def execute_script(script)
browser.execute_script script
nil
end
|
#find(selector) ⇒ Object
130
131
132
|
# File 'lib/capybara/driver/celerity_driver.rb', line 130
def find(selector)
browser.elements_by_xpath(selector).map { |node| Node.new(self, node) }
end
|
#reset! ⇒ Object
154
155
156
|
# File 'lib/capybara/driver/celerity_driver.rb', line 154
def reset!
browser.clear_cookies
end
|
122
123
124
|
# File 'lib/capybara/driver/celerity_driver.rb', line 122
def
browser.
end
|
#source ⇒ Object
114
115
116
|
# File 'lib/capybara/driver/celerity_driver.rb', line 114
def source
browser.html
end
|
#status_code ⇒ Object
126
127
128
|
# File 'lib/capybara/driver/celerity_driver.rb', line 126
def status_code
browser.status_code
end
|
#visit(path) ⇒ Object
106
107
108
|
# File 'lib/capybara/driver/celerity_driver.rb', line 106
def visit(path)
browser.goto(url(path))
end
|
#wait? ⇒ Boolean
134
|
# File 'lib/capybara/driver/celerity_driver.rb', line 134
def wait?; true; end
|