This solution also works

Thanks,
Trevor

On Aug 3, 7:36 am, Raveendran P <[email protected]> wrote:
> 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 <[email protected]> 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 readhttp://watir.com/support. In short: search
> > before you ask, be nice.
>
> > [email protected]
> >http://groups.google.com/group/watir-general
> > [email protected]<http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>
> --
> Regards,
> P.Raveendranhttp://raveendran.wordpress.com

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to