Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium and Uploadify

Is there any way to usefully test an Uploadify file upload with Selenium? I'm using Capybara with Rails, but really, any solution with Selenium would be a starting place. I'm worried I may have to disable Uploadify for Selenium testing.

like image 503
Judson Avatar asked Sep 13 '11 20:09

Judson


2 Answers

I was able to get this to work, by interacting with the JS directly. I added this to my test helper.

def upload_via_uploadify file_input_id, path
  page.execute_script("$('##{file_input_id}').show()")
  attach_file(file_input_id, path)
  page.execute_script("$('##{file_input_id}').uploadifyUpload()")
end

You can't actually trigger a button click because of the flash, but besides that it works great and you can test the rest of the interaction goes as planned

like image 179
Nader Avatar answered Sep 24 '22 13:09

Nader


Look at Flash-selenium project. But it uses JS so you possibly could do interactions with Flash by yourself using JS.

like image 34
Mark Huk Avatar answered Sep 25 '22 13:09

Mark Huk