We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Interact with HTML forms
Page Index Toggle Pages: 1
Interact with HTML forms (Read 307 times)
Interact with HTML forms
Feb 16th, 2009, 6:21pm
 
Is it possible to use processing or JAVA to go to an HTTP address and interact with a form? (i.e enter text into fields and click links?)
I am trying to automate some things with my router's web interface and I really don't want to have to learn a new language's syntax like python or Perl.

Thanks
Re: Interact with HTML forms
Reply #1 - Feb 17th, 2009, 9:53am
 
Yes, but it isn't simple. Somehow, you don't need to get the page, if you already know its structure (form fields).
You have to make a POST message with fields filed and send it with the Client class.

I show in Re: save to web --- image export (class DataUpload.java) how to build such message, it is inspired by a Hack and there might be other examples around.

PS.: learning new language isn't a bad thing... Smiley But it is time consuming, alas. A luxury we don't necessarily have.
In the past, I made such little automation in a simple way: making a copy of the Web page, pre-filling it (with a text editor) and loading it in a Web browser, with a little JavaScript code sending it on load. Thus that's the browser which encodes the POST message for me...
Page Index Toggle Pages: 1