lib/testcentricity_web/web_elements/textfield.rb
def clear
      case get_native_attribute('tagName').downcase.to_sym
      when :textarea
        set('')
        sleep(0.5)
        send_keys(:tab)
      when :div
        set('')
      else
        length = get_value.length
        length.times do
          send_keys(:backspace)
        end
        sleep(0.5)
        if get_value.length > 0
          set('')
          sleep(0.5)
          send_keys(:tab)
        end
      end
    end
# Clear the contents of a text field
#
# @example
#   first_name_field.clear
#
Clear the contents of a text field
Clear the contents of a text field
def clear
      case get_native_attribute('tagName').downcase.to_sym
      when :textarea
        set('')
        sleep(0.5)
        send_keys(:tab)
      when :div
        set('')
      else
        length = get_value.length
        length.times do
          send_keys(:backspace)
        end
        sleep(0.5)
        if get_value.length > 0
          set('')
          sleep(0.5)
          send_keys(:tab)
        end
      end
    end
def clear case get_native_attribute ( 'tagName' ) . downcase . to_sym when :textarea set ( '' ) sleep ( 0.5 ) send_keys ( :tab ) when :div set ( '' ) else length = get_value . length length . times do send_keys ( :backspace ) end sleep ( 0.5 ) if get_value . length > 0 set ( '' ) sleep ( 0.5 ) send_keys ( :tab ) end end end
Clear the contents of a text field
Clear the contents of a text field
example
None