vendor/gems/gems/firewatir-1.2.1/MozillaBaseElement.rb
#
# Description:
#   Returns first element found while traversing the DOM; that matches an 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.element_by_xpath instead.
#
# Input:
#   xpath - The xpath expression or query.
#
# Output:
#   First element in DOM that matched the XPath expression or query.
#

Returns first element found while traversing the DOM; that matches an 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.

First element in DOM that matched the XPath expression or query.
Returns first element found while traversing the DOM ; that matches an 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 . First element in DOM that matched the XPath expression or query .
def element_by_xpath(container, xpath)
            rand_no = rand(1000)
            jssh_command = "var element_xpath_#{rand_no} = null; element_xpath_#{rand_no} = #{DOCUMENT_VAR}.evaluate(\"#{xpath}\", #{DOCUMENT_VAR}, null, #{FIRST_ORDERED_NODE_TYPE}, null).singleNodeValue; element_xpath_#{rand_no};"
            jssh_socket.send("#{jssh_command}\n", 0)             
            result = read_socket()
            if(result == "null" || result == "" || result.include?("exception"))
                @@current_level = 0
                return nil
            else
                @@current_level += 1
                return "element_xpath_#{rand_no}"
            end
        end
def element_by_xpath ( container , xpath ) rand_no = rand ( 1000 ) jssh_command = "var element_xpath_#{rand_no} = null; element_xpath_#{rand_no} = #{DOCUMENT_VAR}.evaluate(\"#{xpath}\", #{DOCUMENT_VAR}, null, #{FIRST_ORDERED_NODE_TYPE}, null).singleNodeValue; element_xpath_#{rand_no};" jssh_socket . send ( "#{jssh_command}\n" , 0 ) result = read_socket ( ) if ( result == "null" || result == "" || result . include? ( "exception" ) ) @@current_level = 0 return nil else @@current_level += 1 return "element_xpath_#{rand_no}" end end
Description:
Returns first element found while traversing the DOM; that matches an given XPath query.
Description : Returns first element found while traversing the DOM ; that matches an given XPath query .
#puts "here locating element by xpath"
 #puts "command send to jssh is : #{jssh_command}"
 #puts "result is : #{result}"

container
<not_specific>
xpath
<not_specific>