Help on developing code for autoform fill in website
Hi ,
I am planning for a code which will open a webpage and fill the form present in the
web page automatically using data present in a XML file.
Not able to finalize how to start with...?
I just have some basic knowledge of Java, help required on how to start.
Thanks.
Re: Help on developing code for autoform fill in website
Is your project supposed to simulate a user with a browser? It loads an HTML page with a form, fills in the data and presses submit?
You'll need to understand HTTP.
Are you going to use 3rd party packages or write it yourself.
Re: Help on developing code for autoform fill in website
Thanks for the reply,
Entirely about the proj: A unix job after successful run should call a java code, which should open a given web link, that link has a form which should be filed by the data present in a XML file automatically .
The XML file is created by the unix job.
Form filling can be done in background and a reference number will be generated after filling the form need to be captured.
No 3rd party software's are used.
Unix part is done, Java code is pending.
Re: Help on developing code for autoform fill in website
You missed this part of my question:
Is your project supposed to simulate a user with a browser? It loads an HTML page with a form, fills in the data and presses submit?
Re: Help on developing code for autoform fill in website
Yes.
As a part of reducing manual effort.
Re: Help on developing code for autoform fill in website
Do you understand HTTP? You will need to know how it works.
To read the HTML page from a server there are several classes you can use: HttpURLConnection, URLConnection or Socket. Easiest first to more work required by you last.
I'm not sure what classes to use to parse the HTML. I don't think there are any for javascript.
Re: Help on developing code for autoform fill in website
@Norm - parsing HTML
Java's Standard Library has this class:
ParserDelegator (Java Platform SE 7 )
Which can do HTML parsing for you. However, most Java programmers I know tell me steer clear of it and use one of the many 3rd party HTML parsers available: TagSoup, JTidy, NekoHTML Jsoup etc.
And out of those Jsoup seems to be the populist choice at the moment because of it's flexible and easy to use API. You can traverse a document using the standard DOM model or use CSS (JQuery like) selectors.
Hope this helps.