简体   繁体   English

HtmlUnit的Click()函数不起作用

[英]Click( ) function of HtmlUnit not working

I was trying to login to yahoo pipes account (using the login page) with a program. 我正在尝试使用程序登录yahoo Pipes帐户(使用登录页面)。 Below is the code I am using. 下面是我正在使用的代码。 On clicking the "Sign In" button this page http://pipes.yahoo.com/pipes/ should open. 单击“登录”按钮后,应该打开此页面http://pipes.yahoo.com/pipes/ But looks like the click() function is not working properly. 但是看起来click()函数无法正常工作。 Since the contents of pages before and after the clicking the "Sign In" button are same. 由于单击“登录”按钮之前和之后的页面内容相同。 This code returns true. 此代码返回true。

I am not able to figure out whats going wrong. 我无法找出问题所在。 Can someone suggest what I am missing? 有人可以建议我所缺少的吗?

Add this: 添加:

webClient.setJavaScriptEnabled(false);
// You can re-enable JS later

Then, remove this: 然后,删除此:

webClient.setRefreshHandler(new RefreshHandler() {
    public void handleRefresh(Page page, URL url, int arg) throws IOException {
        System.out.println("handleRefresh");
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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