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.
91 92 93 |
# File 'lib/capybara/driver/selenium_driver.rb', line 91 def app @app end |
#rack_server ⇒ Object (readonly)
Returns the value of attribute rack_server.
91 92 93 |
# File 'lib/capybara/driver/selenium_driver.rb', line 91 def rack_server @rack_server end |
Class Method Details
.driver ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/capybara/driver/selenium_driver.rb', line 93 def self.driver unless @driver @driver = Selenium::WebDriver.for :firefox at_exit do @driver.quit end end @driver end |
Instance Method Details
#body ⇒ Object
117 118 119 |
# File 'lib/capybara/driver/selenium_driver.rb', line 117 def body browser.page_source end |
#browser ⇒ Object
135 136 137 |
# File 'lib/capybara/driver/selenium_driver.rb', line 135 def browser self.class.driver end |
#cleanup! ⇒ Object
139 140 141 |
# File 'lib/capybara/driver/selenium_driver.rb', line 139 def cleanup! browser.manage. end |
#current_url ⇒ Object
121 122 123 |
# File 'lib/capybara/driver/selenium_driver.rb', line 121 def current_url browser.current_url end |
#evaluate_script(script) ⇒ Object
131 132 133 |
# File 'lib/capybara/driver/selenium_driver.rb', line 131 def evaluate_script(script) browser.execute_script "return #{script}" end |
#find(selector) ⇒ Object
125 126 127 |
# File 'lib/capybara/driver/selenium_driver.rb', line 125 def find(selector) browser.find_elements(:xpath, selector).map { |node| Node.new(self, node) } end |
#source ⇒ Object
113 114 115 |
# File 'lib/capybara/driver/selenium_driver.rb', line 113 def source browser.page_source end |
#visit(path) ⇒ Object
109 110 111 |
# File 'lib/capybara/driver/selenium_driver.rb', line 109 def visit(path) browser.navigate.to(url(path)) end |
#wait? ⇒ Boolean
129 |
# File 'lib/capybara/driver/selenium_driver.rb', line 129 def wait?; true; end |