vendor/gems/gems/firewatir-1.2.1/firewatir.rb
# 
# Description:
#   Factory method to create object of correct Element class while using XPath to get the element.
#

Factory method to create object of correct Element class while using XPath to get the element.
Factory method to create object of correct Element class while using XPath to get the element .
def element_factory(element_name)
            jssh_type = Element.new(element_name,self).element_type
            candidate_class = jssh_type =~ /HTML(.*)Element/ ? $1 : ''
            if candidate_class == 'Input'
                $jssh_socket.send("#{element_name}.type;\n", 0)
                input_type = read_socket().downcase.strip
                puts input_type 
                firewatir_class = input_class(input_type)
            else
                firewatir_class = jssh2firewatir(candidate_class)
            end
            #puts firewatir_class 
            klass = Kernel.const_get(firewatir_class)
            if klass == Element
                klass.new(element_name,self)
            elsif klass == CheckBox
                klass.new(self,:jssh_name,element_name,["checkbox"])
            elsif klass == Radio
                klass.new(self,:jssh_name,element_name,["radio"])
            else
                klass.new(self,:jssh_name,element_name)
            end 
        end
def element_factory ( element_name ) jssh_type = Element . new ( element_name , self ) . element_type candidate_class = jssh_type =~ / HTML(.*)Element / ? $1 : '' if candidate_class == 'Input' $jssh_socket . send ( "#{element_name}.type;\n" , 0 ) input_type = read_socket ( ) . downcase . strip puts input_type firewatir_class = input_class ( input_type ) else firewatir_class = jssh2firewatir ( candidate_class ) end klass = Kernel . const_get ( firewatir_class ) if klass == Element klass . new ( element_name , self ) elsif klass == CheckBox klass . new ( self , :jssh_name , element_name , [ "checkbox" ] ) elsif klass == Radio klass . new ( self , :jssh_name , element_name , [ "radio" ] ) else klass . new ( self , :jssh_name , element_name ) end end
Description:
Factory method to create object of correct Element class while using XPath to get the element.
Description : Factory method to create object of correct Element class while using XPath to get the element .
#puts "jssh type is : #{jssh_type}" # DEBUG
 #puts candidate_class # DEBUG
 # DEBUG
 #puts firewatir_class # DEBUG

element_name
<not_specific>