I'm working out of Head, rather than out of 1.4, but when I try
 
 $IE0.form.methods
 
I get this:
 
ArgumentError: wrong number of arguments (0 for 1)
        from (irb):10:in `form'
        from (irb):10
        from ♥:0
 
which gives me a clue.  I try this:
 
$IE0.form('f').methods
 
...and I get a list of methods back.
 
So it seems as though "form" is either misdocumented as being something that takes two parameters (as SupportsSubElements does), or is buggy such that it should be taking two parameters and is only taking one, and that one is the name.  I note in the source code comments that the intention appears to be to support :index , :name, :id, :method, :action, and :xpath.
 
---Michael B.
 
 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marcus Tettmar
Sent: March 3, 2006 6:54 AM
To: [email protected]
Subject: [Wtr-general] Problem enumerating forms

Hi,

Why does this fail:

  $IE0.goto("http://www.google.com/")
  $IE0.form( :name, "f").text_field( :name, "q").set("ruby")
  $IE0.form( :name, "f").button( :name, "btnG").click

This fails with:

WIN32OLERuntimeError: Failed to get IEnum Interface
    HRESULT error code:0x80020003
      Member not found.

If you look at the source of the google search page form "f" *does* exist and the text field and button exist within it.

This works:

  $IE0.goto("http://www.google.com/")
  $IE0.text_field( :name, "q").set("ruby")
  $IE0.button( :name, "btnG").click

But for a more complicated app that has several forms, which perhaps share names of objects, the first method is necessary. 

Watir WebRecorder correctly records the form for this very reason, but the first block of code fails, even though the form does exist, with those objects in it.  Is this a known problem, or am I missing something?

Thanks!

--
Marcus Tettmar
http://www.mjtnet.com/
Macro Scheduler & WebRecorder for Windows & Web Automation and Testing. WebRecorder for Ruby/Watir now available.
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to