korimo / firewatir

Automatically exported from code.google.com/p/firewatir
0 stars 0 forks source link

Slow typing speed #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
ff=Firefox.new
ff.goto("http://www.google.com/ncr")
ff.text_field(:name, "q").set ("somelongstring")

Expected result: Typing a lot faster than 1 character per second
Actual result: Typing approx 1 character per second

What version of the product are you using? On what operating system?
FireWatir-1.1 on Fedora 7

Please provide any additional information below.
I use FireWatir to test a Mail application in which I need to fill out
several text inputs and text area(s). This issue makes it so that an
average compose can take up to 1 minute to fill in.

If anyone's interested in a dirty fix replace line 1381 in htmlelements.rb
from "doKeyPress( setThis )" to "@o.value = setThis". This doesn't have the
benefits of firing On{KeyUp,Press,Down} for every character, but it does
fill in forms a lot faster.

Original issue reported on code.google.com by ghimus on 22 Oct 2007 at 10:02

GoogleCodeExporter commented 9 years ago
You can directly try filling the textbox using textbox.value = "some value". 
Only
reason why textbox.set("value") is used because there are certain web 
applications
that do fire these events. If in your case these events are not fired/used you 
can
directly set the value from your script. This will save time.

Original comment by ang...@gmail.com on 23 Oct 2007 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by ang...@gmail.com on 8 Apr 2008 at 7:46

GoogleCodeExporter commented 9 years ago

solve slow key type issue on firewatire:
====================================================
need to edit the file  "text_field.rb"
enter to the folder
1)#>cd /usr/lib/ruby/gems/1.8/gems/firewatir-1.7.1/lib/firewatir/elements/
make it writeable
2)#>chmod 777 text_field.rb
edite the proc "def doKeyPress( value )" 
3) put # in front of @o.fireEvent("onKeyDown") and @o.fireEvent("onKeyPress") 
and @o.fireEvent("onKeyPress")
insted enter "fire_key_events"
-----------------------------------
 def doKeyPress( value )

      begin

        max = maxlength

        if (max > 0 && value.length > max)

          original_value = value

          value = original_value[0...max]

          element.log " Supplied string is #{suppliedValue.length} chars, which exceeds the max length (#{max}) of the field. Using value: #{value}"

        end

      rescue

        # probably a text area - so it doesnt have a max Length

      end

      for i in 0..value.length-1

        #sleep element.typingspeed   # typing speed

        c = value[i,1]

        #element.log  " adding c.chr " + c  #.chr.to_s

        @o.value = "#{(@o.value.to_s + c)}"   #c.chr

    fire_key_events #add this

        #@o.fireEvent("onKeyDown")

        #@o.fireEvent("onKeyPress")

        #@o.fireEvent("onKeyUp")

      end
----------------------------------------------
now it should work faster

Original comment by shayefr...@gmail.com on 16 Feb 2011 at 12:09