1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Publically expose the browser objects

This commit is contained in:
Jonas Nicklas 2010-01-01 20:13:54 +01:00
parent 4f2da02a16
commit b096370c65
3 changed files with 18 additions and 20 deletions

View file

@ -82,6 +82,15 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
browser.execute_script "#{script}"
end
def browser
unless @_browser
require 'celerity'
@_browser = ::Celerity::Browser.new(:browser => :firefox, :log_level => :off)
end
@_browser
end
private
def url(path)
@ -92,13 +101,4 @@ private
end
end
def browser
unless @_browser
require 'celerity'
@_browser = ::Celerity::Browser.new(:browser => :firefox, :log_level => :off)
end
@_browser
end
end

View file

@ -12,8 +12,6 @@ class Capybara::Driver::Culerity < Capybara::Driver::Celerity
@_server
end
private
def browser
unless @_browser
@_browser = ::Culerity::RemoteBrowserProxy.new self.class.server, {:browser => :firefox, :log_level => :off}

View file

@ -75,25 +75,29 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
end
def visit(path)
driver.navigate.to(url(path))
browser.navigate.to(url(path))
end
def body
driver.page_source
browser.page_source
end
def current_url
driver.current_url
browser.current_url
end
def find(selector)
driver.find_elements(:xpath, selector).map { |node| Node.new(self, node) }
browser.find_elements(:xpath, selector).map { |node| Node.new(self, node) }
end
def wait?; true; end
def evaluate_script(script)
driver.execute_script "return #{script}"
browser.execute_script "return #{script}"
end
def browser
self.class.driver
end
private
@ -106,8 +110,4 @@ private
end
end
def driver
self.class.driver
end
end