Hi, 

I'm trying to automate photo posting to a tumblr using watir-webdriver. 

I have the following:

require 'watir-webdriver'

b = Watir::Browser.new :firefox, :profile => 'default'
b.goto "http://www.tumblr.com/blog/apologiseinsincerely";

l = b.link :id => 'new_post_label_photo'
l.click
target = b.div :class => 'drop_target'
file_in = b.input :id => 'photo_file_input'
target.click
latest_image = 
Dir["/Users/bryan/projects/bizofme/tumblrs/this_is_just_to_say"].sort { 
|a,b| File.mtime(a) <=> File.mtime(b) }.last
puts latest_image
b.file_field(:id, 'photo_file_input').set latest_image

When I get to b.file_field I get back 

[remote server] 
file:///var/folders/wd/czvmsmpd1c5g70lbxyt9_gx80000gp/T/webdriver-rb-profilecopy20131027-18194-1w5rjei/extensions/[email protected]/components/command_processor.js:8210:in
 
`fxdriver.preconditions.visible': Element is not currently visible and so 
may not be interacted with 
(Selenium::WebDriver::Error::ElementNotVisibleError)

Of course latest_image exists, and I get back the path to it in my puts. 

If I change the last line to 
b.file_field(:id, 'photo_file_input').when_present.set latest_image
Then I get back 

/Users/bryan/.rvm/gems/ruby-1.9.3-p429/gems/watir-webdriver-0.6.4/lib/watir-webdriver/wait.rb:30:in
 
`until': timed out after 30 seconds, waiting for {:id=>"photo_file_input", 
:tag_name=>"input", :type=>"file"} to become present 
(Watir::Wait::TimeoutError

This input is inside of a script element and is a html template, any thing 
I can do to set that value? 
If not is there anyway I can actually work with the upload component? 

Thanks,
Bryan 


-- 
-- 
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/groups/opt_out.

Reply via email to