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
- #evaluate_script(script) ⇒ Object
- #find(selector) ⇒ Object
-
#initialize(app) ⇒ Selenium
constructor
A new instance of Selenium.
- #visit(path) ⇒ Object
- #wait? ⇒ Boolean
Constructor Details
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
54 55 56 |
# File 'lib/capybara/driver/selenium_driver.rb', line 54 def app @app end |
#rack_server ⇒ Object (readonly)
Returns the value of attribute rack_server.
54 55 56 |
# File 'lib/capybara/driver/selenium_driver.rb', line 54 def rack_server @rack_server end |
Class Method Details
.driver ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/capybara/driver/selenium_driver.rb', line 56 def self.driver unless @driver @driver = Selenium::WebDriver.for :firefox at_exit do @driver.quit end end @driver end |
Instance Method Details
#body ⇒ Object
76 77 78 |
# File 'lib/capybara/driver/selenium_driver.rb', line 76 def body driver.page_source end |
#evaluate_script(script) ⇒ Object
86 87 88 |
# File 'lib/capybara/driver/selenium_driver.rb', line 86 def evaluate_script(script) driver.execute_script "return #{script}" end |
#find(selector) ⇒ Object
80 81 82 |
# File 'lib/capybara/driver/selenium_driver.rb', line 80 def find(selector) driver.find_elements(:xpath, selector).map { |node| Node.new(self, node) } end |
#visit(path) ⇒ Object
72 73 74 |
# File 'lib/capybara/driver/selenium_driver.rb', line 72 def visit(path) driver.navigate.to(url(path)) end |
#wait? ⇒ Boolean
84 |
# File 'lib/capybara/driver/selenium_driver.rb', line 84 def wait?; true; end |