Capybara::Driver::Selenium

Attributes

app[R]
rack_server[R]

Public Class Methods

driver() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 90
def self.driver
  unless @driver
    @driver = Selenium::WebDriver.for :firefox
    at_exit do
      @driver.quit
    end
  end
  @driver
end
new(app) click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 100
def initialize(app)
  @app = app
  @rack_server = Capybara::Server.new(@app)
  @rack_server.boot if Capybara.run_server
end

Public Instance Methods

body() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 114
def body
  browser.page_source
end
browser() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 136
def browser
  self.class.driver
end
cleanup!() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 140
def cleanup!
  browser.manage.delete_all_cookies
end
current_url() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 118
def current_url
  browser.current_url
end
evaluate_script(script) click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 132
def evaluate_script(script)
  browser.execute_script "return #{script}"
end
execute_script(script) click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 128
def execute_script(script)
  browser.execute_script script
end
find(selector) click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 122
def find(selector)
  browser.find_elements(:xpath, selector).map { |node| Node.new(self, node) }
end
source() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 110
def source
  browser.page_source
end
visit(path) click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 106
def visit(path)
  browser.navigate.to(url(path))
end
wait?() click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 126
def wait?; true; end
within_frame(frame_id) click to toggle source
# File lib/capybara/driver/selenium_driver.rb, line 144
def within_frame(frame_id)
  old_window = browser.window_handle
  browser.switch_to.frame(frame_id)
  yield
  browser.switch_to.window old_window
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.