On 8 May 2012 12:01, Željko Filipin <[email protected]> wrote:

> On Tue, May 8, 2012 at 4:53 PM, Cassiano Leal <[email protected]>
> wrote:
> >     def file_name
> >       @browser.frame.file_field(id: 'fileName')
> >     end
> >
> >     def file_name=(filename)
> >       file_name.set filename
> >     end
> >
> > The problem is that neither work. :)
>
> Does this work?
>
> @browser.frame.file_field(id: 'fileName').set filename
>
> Do you get any errors or exceptions?
>

It works flawlessly. I copy-pasted the code from inside the method into the
console window and it worked. Calling the method returns nil.

[1] pry(#<SabrixDataInterchange>)> file_name
=> nil
[2] pry(#<SabrixDataInterchange>)> file_name.set filename
NoMethodError: undefined method `set' for nil:NilClass
from (pry):2:in `upload_file'
[4] pry(#<SabrixDataInterchange>)> @browser.frame.file_field(id: 'fileName')
=> #<Watir::FileField:0x48deb6834a25467c located=false
selector={:id=>"fileName", :tag_name=>"input", :type=>"file"}>
[5] pry(#<SabrixDataInterchange>)> @browser.frame.file_field(id:
'fileName').set filename
=> "/path/to/file/omitted"

-- 
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