vendor/gems/gems/firewatir-1.2.1/MozillaBaseElement.rb
#
# Description:
#   Function to fire click event on elements.
#

Function to fire click event on elements.
Function to fire click event on elements .
def click
            assert_exists
            assert_enabled
            highlight(:set)
            case element_type
                when "HTMLAnchorElement", "HTMLImageElement"
                    jssh_command = "var event = #{DOCUMENT_VAR}.createEvent(\"MouseEvents\");"
                    jssh_command += "event.initMouseEvent('click',true,true,null,1,0,0,0,0,false,false,false,false,0,null);"
                    jssh_command += "#{element_object}.dispatchEvent(event);\n"
                    jssh_socket.send("#{jssh_command}", 0)
                    read_socket()
                else
                    jssh_socket.send("typeof(#{element_object}.click);\n", 0)
                    isDefined = read_socket()
                    if(isDefined == "undefined")
                        fire_event("onclick")
                    else
                        jssh_socket.send("#{element_object}.click();\n" , 0)
                        read_socket()
                    end
            end
            highlight(:clear)
            wait()
        end
def click assert_exists assert_enabled highlight ( :set ) case element_type when "HTMLAnchorElement" , "HTMLImageElement" jssh_command = "var event = #{DOCUMENT_VAR}.createEvent(\"MouseEvents\");" jssh_command += "event.initMouseEvent('click',true,true,null,1,0,0,0,0,false,false,false,false,0,null);" jssh_command += "#{element_object}.dispatchEvent(event);\n" jssh_socket . send ( "#{jssh_command}" , 0 ) read_socket ( ) else jssh_socket . send ( "typeof(#{element_object}.click);\n" , 0 ) isDefined = read_socket ( ) if ( isDefined == "undefined" ) fire_event ( "onclick" ) else jssh_socket . send ( "#{element_object}.click();\n" , 0 ) read_socket ( ) end end highlight ( :clear ) wait ( ) end
Description:
Function to fire click event on elements.
Description : Function to fire click event on elements .
#puts "#{element_object} and #{element_type}"
 # Special check for link or anchor tag. Because click() doesn't work on links.
 # More info: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-48250443
 # https://bugzilla.mozilla.org/show_bug.cgi?id=148585
 # Info about initMouseEvent at: http://www.xulplanet.com/references/objref/MouseEvent.html
 #puts "jssh_command is: #{jssh_command}"
 # Wait for firefox to reload.
