I finally found a performance issue and it was in the watir library.

If a page (and dont get me started about it) has 200 plus radio
buttons and your watir script decides to print all the attributes like
so

radios = ie.radios()
for radio in radios
  puts radio.name
  puts radio.value
end

Then please be ready to wait for 16 Minutes .....

It seems it goes slower and slower as the process runs ... asking for
the name or value of the 200th will take a LOT longer than asking for
the name/value of the 1st.

I was somewhat confused when I called ie.radios the documentation
suggests it returns an array of radios.  But that would imply that
asking for a property on the first item in the arrray would be exactly
the same speed as asking for a property on the last (which clearly it
is not).

Now I started to do the same parsing of the document as done by
show_all_objects but I had difficulty replicating some attributes
(like a links text) and some of the element types.

Could someone please look at the performance issues with these
functions or suggest a  function that could output all the page
elements.  I was using the code below and calling with say

puts objectlist(ie.links)
puts objectlist(ie.forms)
puts objectlist(ie.text_fields)
puts objectlist(ie.radios)
puts objectlist(ie.checkboxes)
puts objectlist(ie.select_lists)
puts objectlist(ie.file_fields)
puts objectlist(ie.buttons)

Now normally I was only outputting one when the user called sa radio
(:id,'xxx') and it failed I'd output objectlist(ie.radios) so they
could see all the radios that exist.  But the performance has meant I
have had to comment all that out for now.

  def objectlist(objects)
    objs_info = []
    index=1
    objects.each {|f|
      obj_info = []
      obj_info.push(":index=#{index}")
      index+=1
      begin
        if (f.object_id!="")
          obj_info.push(":id=#{f.object_id}")
        end
      rescue
      end
      begin
        if (f.name!="")
          obj_info.push(":name=#{f.name}")
        end
      rescue
      end
      begin
        if (f.text!="")
          obj_info.push(":text=#{f.text}")
        end
      rescue
      end
      begin
        if (f.value!="")
          obj_info.push(":value=#{f.value}")
        end
      rescue
      end
      puts obj_info.join(", ")
      objs_info.push(obj_info.join(", "))
    }
    return objs_info
  end


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to