4

I need to upload hundreds of files via a html form, so that they end up on a server. I have no other options and must go via the form.

I have tried doing this problematically using python but I'm doing something wrong and the files are empty when I try to open them via the web interface. I also tried doing a replay via firefox's TamperData and the file is also uploaded incorrectly in this case.

So I'm interested in exploring the idea of uploading the files by automating my browser instead. All I need to do is:

for file in files: open a page click on the browse button select a file click the upload button 

So what software/library can I use to do this? I don't necessarily need to do this using python as I will never need to do this again in the future. I just need to get the files up there by any means possible.

I have access to Windows 7, Mac Os X, and Suse Linux.

I also don't care which browser I use.

1
  • silenium webdrive can help you Commented Oct 24, 2013 at 8:49

2 Answers 2

6

Splinter works well for this kind of thing:

https://github.com/cobrateam/splinter

You could do something like:

from splinter import Browser with Browser('firefox') as browser: browser.visit('http://yourwebsite.com') browser.find_by_name('element_name').click() do some other stuff... 

You just need to find the name or ID of the element you want to interact with on the page

Sign up to request clarification or add additional context in comments.

1 Comment

This is a better solution than Selenium, because it's higher-level than Selenium. Also, you can debug it using a desktop browser, then switch to PhantomJS once it's done to make it faster
1

please check out selenium: It's an automated browser tool (behaves like a real user)

http://selenium-python.readthedocs.org/en/latest/

You can also if you're more the techy type and understand html write your own python code to only send files to the server with httplib2

https://code.google.com/p/httplib2/

for an auto clicker try autopy (this emulates mouse and keyboard input)

http://www.autopy.org/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.