lib/webrat/selenium/selenium_session.rb in jwilger-webrat-0.4.4.2 vs lib/webrat/selenium/selenium_session.rb in jwilger-webrat-0.4.4.3
- old
+ new
@@ -32,19 +32,20 @@
def automate
yield
end
- def visit(url)
+ def visit(url, timeout = nil)
selenium.open(url)
+ selenium.wait_for_page_to_load(timeout)
end
webrat_deprecate :visits, :visit
def fill_in(field_identifier, options)
locator = "webrat=#{Regexp.escape(field_identifier)}"
- selenium.wait_for_element locator, :timeout_in_seconds => 5
+ selenium.wait_for_element locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.type(locator, "#{options[:with]}")
end
webrat_deprecate :fills_in, :fill_in
@@ -67,28 +68,28 @@
pattern = adjust_if_regexp(button_text_or_regexp)
end
pattern ||= '*'
locator = "button=#{pattern}"
- selenium.wait_for_element locator, :timeout_in_seconds => 5
+ selenium.wait_for_element locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.click locator
end
webrat_deprecate :clicks_button, :click_button
def click_link(link_text_or_regexp, options = {})
pattern = adjust_if_regexp(link_text_or_regexp)
locator = "webratlink=#{pattern}"
- selenium.wait_for_element locator, :timeout_in_seconds => 5
+ selenium.wait_for_element locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.click locator
end
webrat_deprecate :clicks_link, :click_link
def click_link_within(selector, link_text, options = {})
locator = "webratlinkwithin=#{selector}|#{link_text}"
- selenium.wait_for_element locator, :timeout_in_seconds => 5
+ selenium.wait_for_element locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.click locator
end
webrat_deprecate :clicks_link_within, :click_link_within
@@ -99,26 +100,26 @@
select_locator = "webrat=#{id_or_name_or_label}"
else
select_locator = "webratselectwithoption=#{option_text}"
end
- selenium.wait_for_element select_locator, :timeout_in_seconds => 5
+ selenium.wait_for_element select_locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.select(select_locator, option_text)
end
webrat_deprecate :selects, :select
def choose(label_text)
locator = "webrat=#{label_text}"
- selenium.wait_for_element locator, :timeout_in_seconds => 5
+ selenium.wait_for_element locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.click locator
end
webrat_deprecate :chooses, :choose
def check(label_text)
locator = "webrat=#{label_text}"
- selenium.wait_for_element locator, :timeout_in_seconds => 5
+ selenium.wait_for_element locator, :timeout_in_seconds => Webrat.configuration.browser_action_timeout
selenium.click locator
end
alias_method :uncheck, :check
webrat_deprecate :checks, :check