Rectangle 27 0

java htmlunit knockout js not working. Returning same page on clicking of submit button?


List<WebWindow> webWindows = client.getWebWindows();
WebWindow webWindow = webWindows.get(0);
HtmlPage page = (HtmlPage) webWindow.getEnclosedPage();

the js ajax may have such code "window.location.href"then you should do like this code:

Note
Rectangle 27 0

java htmlunit knockout js not working. Returning same page on clicking of submit button?


loginPage = htmlButton.click();
webClient.waitForBackgroundJavaScript(30000);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.waitForBackgroundJavaScript(30000);

Can you please switch to the latest HtmlUnit version - we did so many changes and we are not able to support that old versions.

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.

One more thing i checked in my page, there are many scripts with <script type="text/html" and in htmlunit, this script is being skipped. This method is being called internally - com.gargoylesoftware.htmlunit.html.HtmlScript.isJavaScript(String typeAttribute, final String languageAttribute) and typeAttribute is text/html and languageAttribute is empty when this method is called. As there is no support in the code to execute text/html, i am getting "Script is not JavaScript (type: text/html, language: ). Skipping execution" log statment Any idea how such scripts can be executed?

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.

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

Note