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