Basically, I have a form.
<form id="frm1" action="random.php" >
<input ... />
<input ... type=hidden name=id value=random_number />
</form>
I need to get the two random values. The action and the hidden value called id. The id of the form does not change. It is always frm1.
I am totally confused on how to do this. I can select the form but don’t know what to do
from there.
Hoping for help.
Thanks
If you haven’t already you should look at this http://jsoup.org/cookbook/extracting-data/dom-navigation
There’s a method on
Elementcalledattr(String key)In your case
formElement.attr("action")should return “random.php”To get the second random number, if there is not an id on the element, you can use
formElement.children()and just iterate the child elements looking for whatever qualifiers you want and pull out the value attribute.