Form submit with the form context in HTMLUnit

100 Views Asked by At

I have a project where I am converting some old HTTPUnit code to HTMLUnit. Among one of the issues I have ran into is the form.submit() option of HTTPUnit.The form.submit works without having to specifically finding the submit button for that particular form provided I have selected the correct form while initializing the form variable earlier.

Is there something similar in HTMLUnit that I could use?

Just to explain the significance of what I am asking, I am testing a shopping site with several forms (for different product) and each form has it own form button with no specific attribute to separate them. Every form has its own different structure and hence finding the submit button using xpath is a bit difficult.

Specifically what I am asking is there a way in HTMLUnit where I could submit a form on basis of the form itself and not the specific submit button? And if not given the above circumstances could anybody please suggest a workaround?

Thanks in advance.

0

There are 0 best solutions below