lib/watir-webdriver/extensions/alerts.rb in watir-webdriver-0.6.11 vs lib/watir-webdriver/extensions/alerts.rb in watir-webdriver-0.7.0
- old
+ new
@@ -13,15 +13,10 @@
#
# Overwrite window.alert()
#
# This method is provided by an optional require - API is subject to change.
#
- # @example
- # browser.alert do
- # browser.button(:value => "Alert").click
- # end #=> "the alert message"
- #
def alert(&blk)
warn 'AlertHelper is deprecated. Use the new Alert API instead (e.g. browser.alert.ok)'
execute_script "window.alert = function(msg) { window.__lastWatirAlert = msg; }"
yield
@@ -31,14 +26,10 @@
#
# Overwrite window.confirm()
#
# This method is provided by an optional require - API is subject to change.
#
- # @example
- # browser.confirm(true) do
- # browser.button(:value => "Confirm").click
- # end #=> "the confirm message"
def confirm(bool, &blk)
warn 'AlertHelper is deprecated. Use the new Alert API instead (e.g. browser.alert.ok)'
execute_script "window.confirm = function(msg) { window.__lastWatirConfirm = msg; return #{!!bool} }"
yield
@@ -47,14 +38,9 @@
#
# Overwrite window.prompt()
#
# This method is provided by an optional require - API is subject to change.
- #
- # @example
- # browser.prompt("hello") do
- # browser.button(:value => "Prompt").click
- # end #=> { :message => "foo", :default_value => "bar" }
#
def prompt(answer, &blk)
warn 'AlertHelper is deprecated. Use the new Alert API instead (e.g. browser.alert.ok)'
execute_script "window.prompt = function(text, value) { window.__lastWatirPrompt = { message: text, default_value: value }; return #{MultiJson.encode answer}; }"