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
#current_path, #has_shortcircuit_timeout?, #wait_until, #within_frame
Constructor Details
#initialize(app) ⇒ Celerity
Returns a new instance of Celerity.
92
93
94
95
96
|
# File 'lib/capybara/driver/celerity_driver.rb', line 92
def initialize(app)
@app = app
@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.
90
91
92
|
# File 'lib/capybara/driver/celerity_driver.rb', line 90
def app
@app
end
|
#rack_server ⇒ Object
Returns the value of attribute rack_server.
90
91
92
|
# File 'lib/capybara/driver/celerity_driver.rb', line 90
def rack_server
@rack_server
end
|
Instance Method Details
#body ⇒ Object
110
111
112
|
# File 'lib/capybara/driver/celerity_driver.rb', line 110
def body
browser.document.as_xml
end
|
#browser ⇒ Object
137
138
139
140
141
142
143
144
|
# File 'lib/capybara/driver/celerity_driver.rb', line 137
def browser
unless @_browser
require 'celerity'
@_browser = ::Celerity::Browser.new(:browser => :firefox, :log_level => :off)
end
@_browser
end
|
#cleanup! ⇒ Object
146
147
148
|
# File 'lib/capybara/driver/celerity_driver.rb', line 146
def cleanup!
browser.clear_cookies
end
|
#current_url ⇒ Object
102
103
104
|
# File 'lib/capybara/driver/celerity_driver.rb', line 102
def current_url
browser.url
end
|
#evaluate_script(script) ⇒ Object
133
134
135
|
# File 'lib/capybara/driver/celerity_driver.rb', line 133
def evaluate_script(script)
browser.execute_script "#{script}"
end
|
#execute_script(script) ⇒ Object
128
129
130
131
|
# File 'lib/capybara/driver/celerity_driver.rb', line 128
def execute_script(script)
browser.execute_script script
nil
end
|
#find(selector) ⇒ Object
122
123
124
|
# File 'lib/capybara/driver/celerity_driver.rb', line 122
def find(selector)
browser.elements_by_xpath(selector).map { |node| Node.new(self, node) }
end
|
114
115
116
|
# File 'lib/capybara/driver/celerity_driver.rb', line 114
def
browser.
end
|
#source ⇒ Object
106
107
108
|
# File 'lib/capybara/driver/celerity_driver.rb', line 106
def source
browser.html
end
|
#status_code ⇒ Object
118
119
120
|
# File 'lib/capybara/driver/celerity_driver.rb', line 118
def status_code
browser.status_code
end
|
#visit(path) ⇒ Object
98
99
100
|
# File 'lib/capybara/driver/celerity_driver.rb', line 98
def visit(path)
browser.goto(url(path))
end
|
#wait? ⇒ Boolean
126
|
# File 'lib/capybara/driver/celerity_driver.rb', line 126
def wait?; true; end
|