vendor/gems/gems/firewatir-1.2.1/MozillaBaseElement.rb
#
# Description:
#   Find all the elements in the document by querying DOM.
#   Set the class variables like length and the variable name of array storing the elements in JSSH.
#
# Output:
#   Array of elements.
#

Find all the elements in the document by querying DOM.
Set the class variables like length and the variable name of array storing the elements in JSSH.

Array of elements.
Find all the elements in the document by querying DOM . Set the class variables like length and the variable name of array storing the elements in JSSH . Array of elements .
def all
            @arr_elements = "arr_coll_#{@@current_level}"
            jssh_command = "var arr_coll_#{@@current_level}=new Array(); "
            if(@container.class == FireWatir::Firefox || @container.class == Frame)
                jssh_command +="var element_collection = null; element_collection = #{DOCUMENT_VAR}.getElementsByTagName(\"*\");
                            if(element_collection != null && typeof(element_collection) != 'undefined')
                            {
                                for (var i = 0; i < element_collection.length; i++)
                                {
                                    if((element_collection[i].tagName != 'BR') && (element_collection[i].tagName != 'HR') && (element_collection[i].tagName != 'DOCTYPE') && (element_collection[i].tagName != 'META') && (typeof(element_collection[i].tagName) != 'undefined'))
                                        arr_coll_#{@@current_level}.push(element_collection[i]);
                                }
                            }
                            arr_coll_#{@@current_level}.length;"
            else
                jssh_command +="var element_collection = null; element_collection = #{@container.element_name}.getElementsByTagName(\"*\");
                                if(element_collection!= null && typeof(element_collection) != 'undefined')
                                {
                                    for (var i = 0; i < element_collection.length; i++)
                                    {
                                        if((element_collection[i].tagName != 'BR') && (element_collection[i].tagName != 'HR') && (element_collection[i].tagName != 'DOCTYPE') && (element_collection[i].tagName != 'META') && (typeof(element_collection[i].tagName) != 'undefined'))
                                        arr_coll_#{@@current_level}.push(element_collection[i]);
                                    }
                                }
                                arr_coll_#{@@current_level}.length;"
            end
            jssh_command.gsub!(/\n/, "")
            jssh_socket.send("#{jssh_command};\n", 0)
            @length = read_socket().to_i;
            elements = nil
            elements = Array.new(@length)
            for i in 0..@length - 1 do
                temp = Element.new("arr_coll_#{@@current_level}[#{i}]", @container)
                elements[i] = temp
            end
            @@current_level += 1
            return elements
        end
def all @arr_elements = "arr_coll_#{@@current_level}" jssh_command = "var arr_coll_#{@@current_level}=new Array(); " if ( @container . class == FireWatir :: Firefox || @container . class == Frame ) jssh_command += "var element_collection = null; element_collection = #{DOCUMENT_VAR}.getElementsByTagName(\"*\");
                            if(element_collection != null && typeof(element_collection) != 'undefined')
                            {
                                for (var i = 0; i < element_collection.length; i++)
                                {
                                    if((element_collection[i].tagName != 'BR') && (element_collection[i].tagName != 'HR') && (element_collection[i].tagName != 'DOCTYPE') && (element_collection[i].tagName != 'META') && (typeof(element_collection[i].tagName) != 'undefined'))
                                        arr_coll_#{@@current_level}.push(element_collection[i]);
                                }
                            }
                            arr_coll_#{@@current_level}.length;" else jssh_command += "var element_collection = null; element_collection = #{@container.element_name}.getElementsByTagName(\"*\");
                                if(element_collection!= null && typeof(element_collection) != 'undefined')
                                {
                                    for (var i = 0; i < element_collection.length; i++)
                                    {
                                        if((element_collection[i].tagName != 'BR') && (element_collection[i].tagName != 'HR') && (element_collection[i].tagName != 'DOCTYPE') && (element_collection[i].tagName != 'META') && (typeof(element_collection[i].tagName) != 'undefined'))
                                        arr_coll_#{@@current_level}.push(element_collection[i]);
                                    }
                                }
                                arr_coll_#{@@current_level}.length;" end jssh_command . gsub! ( / \n / , "" ) jssh_socket . send ( "#{jssh_command};\n" , 0 ) @length = read_socket ( ) . to_i ; elements = nil elements = Array . new ( @length ) for i in 0 .. @length - 1 do temp = Element . new ( "arr_coll_#{@@current_level}[#{i}]" , @container ) elements [ i ] = temp end @@current_level += 1 return elements end
Description:
Find all the elements in the document by querying DOM.
Description : Find all the elements in the document by querying DOM .
# Remove \n that are there in the string as a result of pressing enter while formatting.
 #puts  jssh_command
 #puts "elements length is in locate_tagged_elements is : #{@length}"
