Thursday, April 28, 2011

Automatic Web Form Submission (looking at Javascript, but other methods are welcome)

What is the most efficient way to do automatic form submission? I'm doing this for fairly legit purposes (well, the site concerned doesn't have an option to send mails to a large group of people, so I'm trying to make my own workaround. But it's not for spamming.)

I do remember -- from my days spent playing web-based MMORPGS -- that there exist pure Javascript-based tools that let you automate form submissions. But I never figured out how those tools worked, and I no longer have the source.

So I made an attempt myself -- I tried to open the form-page in an IFrame, and I tried to submit the form from a script running within the parent window. But it quickly became apparent that I couldn't access the frame contents from a script running in a different domain.

I'm considering copying the necessary pages to my computer and modifying it from there, with the goal of giving me control over the input method but still posting the data I generate to the server. However this seems long and complicated -- many dependencies would have to be tracked down. Is there a better way?

Finally, my googling efforts have also turned up libcurl, which allows would allow me to do this by simulating a browser in my script. But it doesn't exactly look that easy to use.

Edit: Languages I am most familiar with: C++ and Python. Some familiarity with PHP. I doubt I would use C++ for this though.

From stackoverflow
  • It would be easiest if we knew what languages you are familiar with

    Use a framework like Watin ( or Selenium ( There's a really simple framework called Cucumber for Ruby which you write almost readable english.

    int3 : Added to question. The links look good, will be checking them out!
  • Selenium should be easy enough to get started with, just download the Selenium IDE and click through the form.


Post a Comment