简体   繁体   中英

HtmlUnit nothing happen when clicking on a Anchor

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!
 test@mail.com
 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM