right now I'm working on an Java Application that can do the weekly »signing in« to some sport activities for me.
Thus, I have to access the Web Page of my sports club, where I leave my 'user name' and 'password'.
The programm doing all the work for me should be as far as possible abstracted from this use.
In such a way that if my sports club alters the actual web page design, I don't have to do the whole work all over again.
My question is:
How can I gain access to certain Html components, i. e. the password text field?
I'm assuming that I know the name of the correlating Html component:
I already have an algorithm that lists me the component names on a Html web page.
Another question would be:
Having access to an Html component, how can I submit the data I just wrote into the Html form?
This reads the data from the site, but doesn't allow me to submit Html forms back to the server.
By writing to a web site I mean addressing it in a way I can do it manually using a web browser.
For me it's not important to immitate high-level interaction with the server, if this means submitting an Html form.
If there are other ways to address the server, maybe by using PHP, that suits me as well.
If there is no difference between addressing a server using PHP and submitting an Html form, I'll probably use HtmlUnit.
To be more precise:
At the end I'd like my application to immitate that someone has entered a keyword into the wikipedia search form.
As if this someone was using a web browser.
Here is an extract of the Html search form from en.wikipeda.org:
I tried addressing it with HtmlUnit but it didn't do as I wanted it to.
Having read in the HtmlForm ("searchform") from the web page I tried reading in the "button" and the "search" from the searchform.
But it seems as the HtmlForm doesn't know about those HtmlElemnts.
At least, if I try getInputByName, as shown on the Gargoyle Software site.
I tried other methods: Those find the elements but I can't use those for submission.
Can you help me with this problem?
If not, maybe you know about how one can work one's way into HtmlUnit.
How do you manage new APIs ?
What exacty do you need more information about to help me?
Joined: Sep 21, 2011
You misunderstand. I'm not trying to help you by writing the code for you, I'm trying to help you by nudging you in the right direction. Explicitly stating the problem is often a good way to seeing the actual problem (and then being able to address it).