vendor/gems/gems/firewatir-1.2.1/MozillaBaseElement.rb
#
# Description:
#   Returns array of elements that matches a given XPath query.
#   Mozilla browser directly supports XPath query on its DOM. So no need to create the DOM tree as WATiR does for IE.
#   Refer: http://developer.mozilla.org/en/docs/DOM:document.evaluate
#   Used internally by Firewatir use ff.elements_by_xpath instead.
#
# Input:
#   xpath - The xpath expression or query.
#
# Output:
#   Array of elements that matched the xpath expression provided as parameter.
#

Returns array of elements that matches a given XPath query.
Mozilla browser directly supports XPath query on its DOM. So no need to create the DOM tree as WATiR does for IE.

The xpath expression or query.

Array of elements that matched the xpath expression provided as parameter.
Returns array of elements that matches a given XPath query . Mozilla browser directly supports XPath query on its DOM . So no need to create the DOM tree as WATiR does for IE . The xpath expression or query . Array of elements that matched the xpath expression provided as parameter .
def elements_by_xpath(container, xpath)
            rand_no = rand(1000)
            jssh_command = "var element_xpath_#{rand_no} = new Array();"
            jssh_command += "var result = #{DOCUMENT_VAR}.evaluate(\"#{xpath}\", #{DOCUMENT_VAR}, null, #{ORDERED_NODE_ITERATOR_TYPE}, null);
                             var iterate = result.iterateNext();
                             while(iterate)
                             {
                                element_xpath_#{rand_no}.push(iterate);
                                iterate = result.iterateNext();
                             }
                             element_xpath_#{rand_no}.length;
                             "
            jssh_command.gsub!(/\n/, "")
            jssh_socket.send("#{jssh_command};\n", 0)             
            node_count = read_socket()
            elements = Array.new(node_count.to_i)
            for i in 0..elements.length - 1 do
                elements[i] = "element_xpath_#{rand_no}[#{i}]"
            end
            return elements;
        end
def elements_by_xpath ( container , xpath ) rand_no = rand ( 1000 ) jssh_command = "var element_xpath_#{rand_no} = new Array();" jssh_command += "var result = #{DOCUMENT_VAR}.evaluate(\"#{xpath}\", #{DOCUMENT_VAR}, null, #{ORDERED_NODE_ITERATOR_TYPE}, null);
                             var iterate = result.iterateNext();
                             while(iterate)
                             {
                                element_xpath_#{rand_no}.push(iterate);
                                iterate = result.iterateNext();
                             }
                             element_xpath_#{rand_no}.length;
                             " jssh_command . gsub! ( / \n / , "" ) jssh_socket . send ( "#{jssh_command};\n" , 0 ) node_count = read_socket ( ) elements = Array . new ( node_count . to_i ) for i in 0 .. elements . length - 1 do elements [ i ] = "element_xpath_#{rand_no}[#{i}]" end return elements ; end
Description:
Returns array of elements that matches a given XPath query.
Description : Returns array of elements that matches a given XPath query .
#jssh_command = "var xpathResult = #{DOCUMENT_VAR}.evaluate(\"count(#{xpath})\", #{DOCUMENT_VAR}, null, #{NUMBER_TYPE}, null); xpathResult.numberValue;"
 #jssh_socket.send("#{jssh_command}\n", 0);
 #node_count = read_socket()
 # Remove \n that are there in the string as a result of pressing enter while formatting.
 #puts jssh_command
 #puts "value of count is : #{node_count}"

container
<not_specific>
xpath
<not_specific>