Hello,

I'm using Watir with PageObject.
This is how I'm doing the file upload, hope it helps:

file_field :browse, id: "id_of_element"

 self.browse = "#{Dir.pwd}/features/support/files/name_of_file.txt" 



On Thursday, May 14, 2015 at 8:07:14 PM UTC+3, Pilot wrote:
>
> Hi there, 
>
> I'm newbie in Watir. Could someone please suggest a way to select file to 
> upload from popup window on OSX.
>
> I'm practicing on gmail.com. Here is my code:
>
> # Open gmail.com and sign in;
> # Click COMPOSE button;
> # Then:
>
> @browser.div(:class => "T-I J-J5-Ji T-I-KE L3").click
> @browser.div(:text => 'New Message').wait_until_present
> file_name = "/Users/username/Desktop/filename.png"
> puts (File.exists? file_name) //true
> @browser.div(:class => 'a1 aaA aMZ').click // window with title "File Upload" 
> popup
> @browser.file_field(:title => 'File Upload').set(file_name) // probably wrong 
> method, but so far i can't find better solution
> @browser.send_keys(:return)
>
>
> Return an error for me:
> Watir::Exception::UnknownObjectException: unable to locate element, using 
> {:title=>"File Upload", :tag_name=>"input", :type=>"file"} 
>
>

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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to