Reputation: 67
I use Htmlunit library to connect to this website http://www.tellmemorecampus.com/login.aspx but when i use onlick method on the HtmlAnchor nothing happened...
this is my code :
HtmlTextInput emailField = login.getHtmlElementById("userNameText");
emailField.type(email); // works
HtmlPasswordInput passwordField = login.getHtmlElementById("passwordText");
passwordField.type(password); // works
HtmlAnchor submit = login.getHtmlElementById("btnSignIn");
HtmlPage result = submit.click(); // doesn't work
System.out.println(result.asText()); ```
I have this
``` Rosetta Stone
Choose an Interface Language
Rosetta Stone® Language Learning Suite
Rosetta Stone® Advantage
Welcome!
[email protected]
sqsqs
Sign In
Forgot your user name or password?
Terms and Conditions
Privacy Policy
Agreements
Help
Copyright © 2014 Rosetta Stone Ltd. All rights reserved. ```
Thank you.
Upvotes: 0
Views: 59
Reputation: 2879
Try instead of
HtmlPage result = submit.click();
this code
HtmlPage result = submit.click();
webClient.waitForBackgroundJavaScript(10_000);
result = ((HtmlPage) result.getEnclosingWindow().getEnclosedPage());
If this still does not work, please open an issue at https://github.com/HtmlUnit/htmlunit/issues and provide account data via my private mail.
Upvotes: 1