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

Move back some session specific code

This commit is contained in:
Jonas Nicklas 2010-07-10 01:42:59 +02:00
parent b1dd702508
commit 79528de69d
2 changed files with 23 additions and 23 deletions

View file

@ -13,12 +13,6 @@ module Capybara
super || @driver_node.respond_to?(method)
end
def all_unfiltered(locator)
XPath.wrap(locator).paths.map do |path|
@driver_node.send(:all_unfiltered, path)
end.flatten
end
def click_link_or_button(locator)
msg = "no link or button '#{locator}' found"
locate(:xpath, XPath.link(locator).button(locator), msg).click
@ -168,11 +162,6 @@ module Capybara
has_no_xpath?(XPath.table(locator, options))
end
def save_and_open_page
require 'capybara/save_and_open_page'
Capybara::SaveAndOpenPage.save_and_open_page(body)
end
#return node identified by locator or raise ElementNotFound(using desc)
def locate(kind_or_locator, locator=nil, fail_msg = nil)
node = wait_conditionally_until { find(kind_or_locator, locator) }
@ -181,18 +170,6 @@ module Capybara
return node
end
def wait_until(timeout = Capybara.default_wait_time)
Capybara.timeout(timeout,driver) { yield }
end
def execute_script(script)
driver.execute_script(script)
end
def evaluate_script(script)
driver.evaluate_script(script)
end
def find(*args)
all(*args).first
end
@ -245,6 +222,12 @@ module Capybara
protected
def all_unfiltered(locator)
XPath.wrap(locator).paths.map do |path|
@driver_node.send(:all_unfiltered, path)
end.flatten
end
def driver
@session.driver
end

View file

@ -80,6 +80,23 @@ module Capybara
end
end
def wait_until(timeout = Capybara.default_wait_time)
Capybara.timeout(timeout,driver) { yield }
end
def execute_script(script)
driver.execute_script(script)
end
def evaluate_script(script)
driver.evaluate_script(script)
end
def save_and_open_page
require 'capybara/save_and_open_page'
Capybara::SaveAndOpenPage.save_and_open_page(body)
end
private
def current_node