Class: Capybara::Driver::Selenium
- Defined in:
- lib/capybara/driver/selenium_driver.rb
Defined Under Namespace
Classes: Node
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#rack_server ⇒ Object
readonly
Returns the value of attribute rack_server.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
- #browser ⇒ Object
- #cleanup! ⇒ Object
- #current_url ⇒ Object
- #evaluate_script(script) ⇒ Object
- #find(selector) ⇒ Object
-
#initialize(app) ⇒ Selenium
constructor
A new instance of Selenium.
- #source ⇒ Object
- #visit(path) ⇒ Object
- #wait? ⇒ Boolean
Methods inherited from Base
Constructor Details
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
79 80 81 |
# File 'lib/capybara/driver/selenium_driver.rb', line 79 def app @app end |
#rack_server ⇒ Object (readonly)
Returns the value of attribute rack_server.
79 80 81 |
# File 'lib/capybara/driver/selenium_driver.rb', line 79 def rack_server @rack_server end |
Class Method Details
.driver ⇒ Object
81 82 83 84 85 86 87 88 89 |
# File 'lib/capybara/driver/selenium_driver.rb', line 81 def self.driver unless @driver @driver = Selenium::WebDriver.for :firefox at_exit do @driver.quit end end @driver end |
Instance Method Details
#body ⇒ Object
105 106 107 |
# File 'lib/capybara/driver/selenium_driver.rb', line 105 def body browser.page_source end |
#browser ⇒ Object
123 124 125 |
# File 'lib/capybara/driver/selenium_driver.rb', line 123 def browser self.class.driver end |
#cleanup! ⇒ Object
127 128 129 |
# File 'lib/capybara/driver/selenium_driver.rb', line 127 def cleanup! browser.manage. end |
#current_url ⇒ Object
109 110 111 |
# File 'lib/capybara/driver/selenium_driver.rb', line 109 def current_url browser.current_url end |
#evaluate_script(script) ⇒ Object
119 120 121 |
# File 'lib/capybara/driver/selenium_driver.rb', line 119 def evaluate_script(script) browser.execute_script "return #{script}" end |
#find(selector) ⇒ Object
113 114 115 |
# File 'lib/capybara/driver/selenium_driver.rb', line 113 def find(selector) browser.find_elements(:xpath, selector).map { |node| Node.new(self, node) } end |
#source ⇒ Object
101 102 103 |
# File 'lib/capybara/driver/selenium_driver.rb', line 101 def source browser.page_source end |
#visit(path) ⇒ Object
97 98 99 |
# File 'lib/capybara/driver/selenium_driver.rb', line 97 def visit(path) browser.navigate.to(url(path)) end |
#wait? ⇒ Boolean
117 |
# File 'lib/capybara/driver/selenium_driver.rb', line 117 def wait?; true; end |