Class: Capybara::Driver::Selenium
- Inherits:
-
Object
- Object
- 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
- #find(selector) ⇒ Object
-
#initialize(app) ⇒ Selenium
constructor
A new instance of Selenium.
- #visit(path) ⇒ Object
Constructor Details
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
53 54 55 |
# File 'lib/capybara/driver/selenium_driver.rb', line 53 def app @app end |
#rack_server ⇒ Object (readonly)
Returns the value of attribute rack_server.
53 54 55 |
# File 'lib/capybara/driver/selenium_driver.rb', line 53 def rack_server @rack_server end |
Class Method Details
.driver ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/capybara/driver/selenium_driver.rb', line 55 def self.driver unless @driver @driver = Selenium::WebDriver.for :firefox at_exit do @driver.quit end end @driver end |
Instance Method Details
#body ⇒ Object
75 76 77 |
# File 'lib/capybara/driver/selenium_driver.rb', line 75 def body driver.page_source end |
#find(selector) ⇒ Object
79 80 81 |
# File 'lib/capybara/driver/selenium_driver.rb', line 79 def find(selector) driver.find_elements(:xpath, selector).map { |node| Node.new(self, node) } end |
#visit(path) ⇒ Object
71 72 73 |
# File 'lib/capybara/driver/selenium_driver.rb', line 71 def visit(path) driver.navigate.to(url(path)) end |