Salut Marc,

I've done something *really* bad...
I've modified the getEnclosingForm() from HtmlUnit.HtmlElement method as below :
*    public HtmlForm getEnclosingForm() {
       HtmlForm form = (HtmlForm) getEnclosingElement("form");
       HtmlForm test = null;
       while (form!=null){
           test = form;
           form = (HtmlForm) test.getEnclosingElement("form");
       }
       return test;
   }*

Previously, only *return (HtmlForm) getEnclosingElement("form");* was in the function. Now, when it finds a form, it verifies if this form has a parent form. All works well in my case, and I can do my tests. All the fields (child form children included) appeared to be recognized by the perent form, and the submit goes well. In my case, there is no incidence on the behaviour
of the tests...
And yes, it is MS generated...
I hope you'll forgive me ;-)

cheers

Florent

Marc Guillemot a écrit :
Salut Florent,

the best solution is surely to fix this malformed html code! ;-) (or is
it generated by MS library?)

As workaround you can play with HtmlUnit API to move the button node
from the 2nd form to the first one before clicking it.

Btw can you provide a minimal html file with these enclosed forms?

Marc.


--
Pingwy
27, rue des arènes
49100 Angers

Reply via email to