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, LocateHiddenElementError, Node, NotSupportedByDriverError, OptionNotFound, Server, Session, TimeoutError, UnselectNotAllowed, WaitUntil, XPath
Constant Summary collapse
- VERSION =
'0.3.2'
Class Attribute Summary collapse
-
.app ⇒ Object
Returns the value of attribute app.
-
.app_host ⇒ Object
Returns the value of attribute app_host.
-
.asset_root ⇒ Object
Returns the value of attribute asset_root.
- .current_driver ⇒ Object (also: mode)
-
.debug ⇒ Object
Returns the value of attribute debug.
- .default_driver ⇒ Object
-
.default_selector ⇒ Object
Returns the value of attribute default_selector.
-
.default_wait_time ⇒ Object
Returns the value of attribute default_wait_time.
-
.ignore_hidden_elements ⇒ Object
Returns the value of attribute ignore_hidden_elements.
- .javascript_driver ⇒ Object
-
.run_server ⇒ Object
Returns the value of attribute run_server.
Class Method Summary collapse
- .current_session ⇒ Object
- .current_session? ⇒ Boolean
- .log(message) ⇒ Object
- .reset_sessions! ⇒ Object
- .use_default_driver ⇒ Object
Instance Method Summary collapse
Class Attribute Details
.app ⇒ Object
Returns the value of attribute app.
7 8 9 |
# File 'lib/capybara/dsl.rb', line 7 def app @app end |
.app_host ⇒ Object
Returns the value of attribute app_host.
18 19 20 |
# File 'lib/capybara.rb', line 18 def app_host @app_host end |
.asset_root ⇒ Object
Returns the value of attribute asset_root.
18 19 20 |
# File 'lib/capybara.rb', line 18 def asset_root @asset_root end |
.current_driver ⇒ Object Also known as: mode
13 14 15 |
# File 'lib/capybara/dsl.rb', line 13 def current_driver @current_driver || default_driver end |
.debug ⇒ Object
Returns the value of attribute debug.
18 19 20 |
# File 'lib/capybara.rb', line 18 def debug @debug end |
.default_driver ⇒ Object
9 10 11 |
# File 'lib/capybara/dsl.rb', line 9 def default_driver @default_driver || :rack_test end |
.default_selector ⇒ Object
Returns the value of attribute default_selector.
19 20 21 |
# File 'lib/capybara.rb', line 19 def default_selector @default_selector end |
.default_wait_time ⇒ Object
Returns the value of attribute default_wait_time.
19 20 21 |
# File 'lib/capybara.rb', line 19 def default_wait_time @default_wait_time end |
.ignore_hidden_elements ⇒ Object
Returns the value of attribute ignore_hidden_elements.
19 20 21 |
# File 'lib/capybara.rb', line 19 def ignore_hidden_elements @ignore_hidden_elements end |
.javascript_driver ⇒ Object
18 19 20 |
# File 'lib/capybara/dsl.rb', line 18 def javascript_driver @javascript_driver || :selenium end |
.run_server ⇒ Object
Returns the value of attribute run_server.
18 19 20 |
# File 'lib/capybara.rb', line 18 def run_server @run_server end |
Class Method Details
.current_session ⇒ Object
26 27 28 |
# File 'lib/capybara/dsl.rb', line 26 def current_session session_pool["#{current_driver}#{app.object_id}"] ||= Capybara::Session.new(current_driver, app) end |
.current_session? ⇒ Boolean
30 31 32 |
# File 'lib/capybara/dsl.rb', line 30 def current_session? session_pool.has_key?("#{current_driver}#{app.object_id}") end |
.log(message) ⇒ Object
29 30 31 32 |
# File 'lib/capybara.rb', line 29 def log() puts "[capybara] #{}" if debug true end |
.reset_sessions! ⇒ Object
34 35 36 37 |
# File 'lib/capybara/dsl.rb', line 34 def reset_sessions! session_pool.each { |mode, session| session.cleanup! } @session_pool = nil end |
.use_default_driver ⇒ Object
22 23 24 |
# File 'lib/capybara/dsl.rb', line 22 def use_default_driver @current_driver = nil end |
Instance Method Details
#page ⇒ Object
48 49 50 |
# File 'lib/capybara/dsl.rb', line 48 def page Capybara.current_session end |