Hi,

Try thi


#*puts doc*     => retruns the text
So Pelase convert doc into String

*doc=doc.to_s*

puts doc.class => String (The next line works only the inoput is String or
Fixnum.)

*$browser.text_field(:id, "NewAEPGrid_ctl02_CoDFBox2").set(doc)  *

Now it should work .. Let me update here




On Tue, Aug 2, 2011 at 9:26 PM, Trevor <ti_ma...@btopenworld.com> wrote:

> watir version = 1.9.2
> ruby version = 1.8.7
>
> Hi,
> I need to read XML from a document and put it into a textarea.
> I use REXML to read the file, but when I try to dump this into the
> textarea I get an error and the field shows [object]
>
> eg
>        file = File.new( "C:/canoe1.xml" )
>        doc = Document.new file
> #       puts doc
>        $browser.text_field(:id, "NewAEPGrid_ctl02_CoDFBox2").set(doc)
>
> If I uncomment the "puts doc", I can see that the XML is being read
> into doc.
>
> If I change the .set(doc) to e.g. .set("test") then the word test is
> written OK into the field with no error.
>
> The error I see is:
> NoMethodError: undefined method `value' for <UNDEFINED> ... </
> >:REXML::Document
>    C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.9.1/lib/watir/
> input_elements.rb:382:in `method_missing'
>    C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.9.1/lib/watir/
> input_elements.rb:382:in `set'
>    C:/WATIR/CanoeETVScheduler/xml_test.rb:29:in `test01_NewAEP'
>
> Is what I am trying to do actually possible or do I need to
> investigate other options (the only similar post I found seemed to
> suggest using cut'n'paste from an editor)
>
> Thanks
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com<http://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com>
>



-- 
Regards,
P.Raveendran
http://raveendran.wordpress.com

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to