Without knowing the url to analyze your page i can only guess.
is not a option. Doing it during WebClient setup is useless. You have to place this call after your click
loginPage = htmlButton.click();
Maybe it is an option to use WETATOR (www.wetator.org) for your testing. Interaction with an web page is much simpler and all the wait magic is done automatically for you.
That helps. Thank you but now next problem - When i login to the application in browser, I see submit button goes disabled for a while and then it redirects to next page. In our code, page returned from clicking the button has button as disabled and that's it. Nothing is happening after it. It's not re-directing to the next page.
Can you please switch to the latest HtmlUnit version - we did so many changes and we are not able to support that old versions.