单击Java中的跨度

时间:2019-02-25 11:20:24

标签: java htmlunit

在下一页https://leren.saxion.nl/webapps/bb-auth-provider-shibboleth-bb_bb60/execute/shibbolethLogin上,我正在尝试自动登录。我已经设法在正确的字段中输入正确的用户名和密码。

但是,当我尝试单击“登录”按钮时,什么也没有发生,页面没有更改。目前,我的代码如下:

    private static WebClient login(WebClient webClient) throws Exception
    {
        webClient.getOptions().setJavaScriptEnabled(true);
        HtmlPage currentPage = webClient.getPage("https://leren.saxion.nl/webapps/bb-auth-provider-shibboleth-bb_bb60/execute/shibbolethLogin");


        HtmlInput username = currentPage.getElementByName("UserName"); 
        username.setValueAttribute("user");

        HtmlInput password = currentPage.getElementByName("Password"); 
        password.setValueAttribute("pass");

        HtmlSpan button = (HtmlSpan) currentPage.getElementById("submitButton");
        button.click();

        return webClient;
    }

0 个答案:

没有答案
相关问题