Module: Capybara
- Extended by:
- Capybara
- Included in:
- Capybara
- Defined in:
- lib/capybara.rb,
lib/capybara/dsl.rb,
lib/capybara/node.rb,
lib/capybara/xpath.rb,
lib/capybara/session.rb,
lib/capybara/searchable.rb,
lib/capybara/wait_until.rb,
lib/capybara/save_and_open_page.rb
Defined Under Namespace
Modules: Driver, SaveAndOpenPage, Searchable
Classes: CapybaraError, DriverNotFoundError, ElementNotFound, InfiniteRedirectError, Node, NotSupportedByDriverError, Server, Session, TimeoutError, WaitUntil, XPath
Constant Summary
collapse
- VERSION =
'0.3.0'
- SESSION_METHODS =
[
:visit, :current_url, :body, :click_link, :click_button, :drag, :fill_in,
:choose, :has_xpath?, :has_no_xpath?, :has_css?, :has_no_css?,
:check, :uncheck, :attach_file, :select, :source,
:has_content?, :has_no_content?, :within, :within_fieldset, :within_table,
:save_and_open_page, :find, :find_field, :find_link, :find_button,
:field_labeled, :all, :locate, :evaluate_script,
:click, :wait_until
]
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.app ⇒ Object
Returns the value of attribute app.
5
6
7
|
# File 'lib/capybara/dsl.rb', line 5
def app
@app
end
|
.app_host ⇒ Object
Returns the value of attribute app_host.
15
16
17
|
# File 'lib/capybara.rb', line 15
def app_host
@app_host
end
|
.asset_root ⇒ Object
Returns the value of attribute asset_root.
15
16
17
|
# File 'lib/capybara.rb', line 15
def asset_root
@asset_root
end
|
.current_driver ⇒ Object
Also known as:
mode
11
12
13
|
# File 'lib/capybara/dsl.rb', line 11
def current_driver
@current_driver || default_driver
end
|
.debug ⇒ Object
Returns the value of attribute debug.
15
16
17
|
# File 'lib/capybara.rb', line 15
def debug
@debug
end
|
.default_driver ⇒ Object
7
8
9
|
# File 'lib/capybara/dsl.rb', line 7
def default_driver
@default_driver || :rack_test
end
|
.default_selector ⇒ Object
19
20
21
|
# File 'lib/capybara.rb', line 19
def default_selector
@default_selector ||= :xpath
end
|
.default_wait_time ⇒ Object
23
24
25
|
# File 'lib/capybara.rb', line 23
def default_wait_time
@default_wait_time ||= 2
end
|
.javascript_driver ⇒ Object
16
17
18
|
# File 'lib/capybara/dsl.rb', line 16
def javascript_driver
@javascript_driver || :selenium
end
|
Class Method Details
.current_session ⇒ Object
24
25
26
|
# File 'lib/capybara/dsl.rb', line 24
def current_session
session_pool["#{current_driver}#{app.object_id}"] ||= Capybara::Session.new(current_driver, app)
end
|
.current_session? ⇒ Boolean
28
29
30
|
# File 'lib/capybara/dsl.rb', line 28
def current_session?
session_pool.has_key?("#{current_driver}#{app.object_id}")
end
|
.log(message) ⇒ Object
27
28
29
30
|
# File 'lib/capybara.rb', line 27
def log(message)
puts "[capybara] #{message}" if debug
true
end
|
.reset_sessions! ⇒ Object
32
33
34
|
# File 'lib/capybara/dsl.rb', line 32
def reset_sessions!
@session_pool = nil
end
|
.use_default_driver ⇒ Object
20
21
22
|
# File 'lib/capybara/dsl.rb', line 20
def use_default_driver
@current_driver = nil
end
|