vendor/gems/gems/firewatir-1.2.1/firewatir.rb
#
# Description:
#   Tells FireWatir to click javascript button in case one comes after performing some action on an element. Matches
#   text of pop up with one if supplied as parameter. If text matches clicks the button else stop script execution until
#   pop up is dismissed by manual intervention.
# 
# Input:
#   button      - JavaScript button to be clicked. Values can be OK or Cancel
#   waitTime    - Time to wait for pop up to come. Not used just for compatibility with Watir.
#   userInput   - Not used just for compatibility with Watir
#   text        - Text that should appear on pop up.
#

Tells FireWatir to click javascript button in case one comes after performing some action on an element. Matches
text of pop up with one if supplied as parameter. If text matches clicks the button else stop script execution until
pop up is dismissed by manual intervention.

button      - JavaScript button to be clicked. Values can be OK or Cancel
waitTime    - Time to wait for pop up to come. Not used just for compatibility with Watir.
userInput   - Not used just for compatibility with Watir
text        - Text that should appear on pop up.
Tells FireWatir to click javascript button in case one comes after performing some action on an element . Matches text of pop up with one if supplied as parameter . If text matches clicks the button else stop script execution until pop up is dismissed by manual intervention . button - JavaScript button to be clicked . Values can be OK or Cancel waitTime - Time to wait for pop up to come . Not used just for compatibility with Watir . userInput - Not used just for compatibility with Watir text - Text that should appear on pop up .
def startClicker(button, waitTime = 1, userInput = nil, text = nil)
            jssh_command = "var win = #{BROWSER_VAR}.contentWindow;"
            if(button =~ /ok/i)
                jssh_command += "var popuptext = '';
                                 var old_alert = win.alert;
                                 var old_confirm = win.confirm;
                                 win.alert = function(param) {"
                if(text != nil)                 
                    jssh_command +=          "if(param == \"#{text}\") {
                                                popuptext = param; 
                                                return true;
                                              }
                                              else {
                                                popuptext = param;
                                                win.alert = old_alert;
                                                win.alert(param);
                                              }"
                else
                    jssh_command +=          "popuptext = param; return true;"
                end
                jssh_command += "};
                                 win.confirm = function(param) {"
                if(text != nil)                 
                    jssh_command +=          "if(param == \"#{text}\") {
                                                popuptext = param; 
                                                return true;
                                              }
                                              else {
                                                win.confirm = old_confirm;
                                                win.confirm(param);
                                              }"
                else
                    jssh_command +=          "popuptext = param; return true;"
                end
                jssh_command += "};"
            elsif(button =~ /cancel/i)
                jssh_command = "var old_confirm = win.confirm; 
                                              win.confirm = function(param) {"
                if(text != nil)                 
                    jssh_command +=          "if(param == \"#{text}\") {
                                                popuptext = param; 
                                                return false;
                                              }
                                              else {
                                                win.confirm = old_confirm;
                                                win.confirm(param);
                                              }"
                else
                    jssh_command +=          "popuptext = param; return false;"
                end
                jssh_command += "};"
            end
            jssh_command.gsub!(/\n/, "")
            $jssh_socket.send("#{jssh_command}\n", 0)
            read_socket()
        end
def startClicker ( button , waitTime = 1 , userInput = nil , text = nil ) jssh_command = "var win = #{BROWSER_VAR}.contentWindow;" if ( button =~ / ok /i ) jssh_command += "var popuptext = '';
                                 var old_alert = win.alert;
                                 var old_confirm = win.confirm;
                                 win.alert = function(param) {" if ( text != nil ) jssh_command += "if(param == \"#{text}\") {
                                                popuptext = param; 
                                                return true;
                                              }
                                              else {
                                                popuptext = param;
                                                win.alert = old_alert;
                                                win.alert(param);
                                              }" else jssh_command += "popuptext = param; return true;" end jssh_command += "};
                                 win.confirm = function(param) {" if ( text != nil ) jssh_command += "if(param == \"#{text}\") {
                                                popuptext = param; 
                                                return true;
                                              }
                                              else {
                                                win.confirm = old_confirm;
                                                win.confirm(param);
                                              }" else jssh_command += "popuptext = param; return true;" end jssh_command += "};" elsif ( button =~ / cancel /i ) jssh_command = "var old_confirm = win.confirm; 
                                              win.confirm = function(param) {" if ( text != nil ) jssh_command += "if(param == \"#{text}\") {
                                                popuptext = param; 
                                                return false;
                                              }
                                              else {
                                                win.confirm = old_confirm;
                                                win.confirm(param);
                                              }" else jssh_command += "popuptext = param; return false;" end jssh_command += "};" end jssh_command . gsub! ( / \n / , "" ) $jssh_socket . send ( "#{jssh_command}\n" , 0 ) read_socket ( ) end
Description:
Tells FireWatir to click javascript button in case one comes after performing some action on an element.
Description : Tells FireWatir to click javascript button in case one comes after performing some action on an element .
#puts "jssh command sent for js pop up is : #{jssh_command}"

button
<not_specific>
waitTime
<not_specific>
userInput
<not_specific>
text
<not_specific>