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
- #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.
58 59 60 |
# File 'lib/capybara/driver/selenium_driver.rb', line 58 def app @app end |
#rack_server ⇒ Object (readonly)
Returns the value of attribute rack_server.
58 59 60 |
# File 'lib/capybara/driver/selenium_driver.rb', line 58 def rack_server @rack_server end |
Class Method Details
.driver ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/capybara/driver/selenium_driver.rb', line 60 def self.driver unless @driver @driver = Selenium::WebDriver.for :firefox at_exit do @driver.quit end end @driver end |
Instance Method Details
#body ⇒ Object
85 86 87 |
# File 'lib/capybara/driver/selenium_driver.rb', line 85 def body browser.page_source end |
#browser ⇒ Object
103 104 105 |
# File 'lib/capybara/driver/selenium_driver.rb', line 103 def browser self.class.driver end |
#current_url ⇒ Object
89 90 91 |
# File 'lib/capybara/driver/selenium_driver.rb', line 89 def current_url browser.current_url end |
#evaluate_script(script) ⇒ Object
99 100 101 |
# File 'lib/capybara/driver/selenium_driver.rb', line 99 def evaluate_script(script) browser.execute_script "return #{script}" end |
#find(selector) ⇒ Object
93 94 95 |
# File 'lib/capybara/driver/selenium_driver.rb', line 93 def find(selector) browser.find_elements(:xpath, selector).map { |node| Node.new(self, node) } end |
#source ⇒ Object
81 82 83 |
# File 'lib/capybara/driver/selenium_driver.rb', line 81 def source browser.page_source end |
#visit(path) ⇒ Object
77 78 79 |
# File 'lib/capybara/driver/selenium_driver.rb', line 77 def visit(path) browser.navigate.to(url(path)) end |
#wait? ⇒ Boolean
97 |
# File 'lib/capybara/driver/selenium_driver.rb', line 97 def wait?; true; end |