htmlunit模拟表单的问题 大牛进 谢谢啦

由于公司需求,需要做一个模拟登录招商银行查询银行流水。

地址:https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/LoginOLD.aspx

我一开始尝试模拟表单,控件可以加载,但是密码无法输入。
所以准备换方式。换成POST提交方式
地址:https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/LoginOLD.aspx

但是可能因为某些参数影响了,导致一直提示:

    由于您长时间未操作本功能,系统已自动关闭本功能,请重新操作#1



            以下是本人代码

                     WebClient webClient = new WebClient();  
     webClient.getOptions().setUseInsecureSSL(true);
        webClient.getCookieManager().setCookiesEnabled(true);// 开启cookie管理
        webClient.getOptions().setTimeout(90000);
        webClient.getOptions().setCssEnabled(true);
        webClient.getOptions().setJavaScriptEnabled(true);
        webClient.setJavaScriptTimeout(40000);
        webClient.getOptions().setRedirectEnabled(true);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
    WebRequest webRequest=new WebRequest(new URL("https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/GenUniLogin.aspx"));
    List<NameValuePair> List=new ArrayList<NameValuePair>();
    List.add(new NameValuePair("ClientNo","4266F7C76935130C21C10F17D74C9E59424556816224276600032831"));
    //List.add(new NameValuePair("ExtraPwd","1231"));
    List.add(new NameValuePair("CreditCardVersion","2.0"));
    List.add(new NameValuePair("BranchNo","0028"));
    List.add(new NameValuePair("AccountNo","11"));
    List.add(new NameValuePair("Password","undefined"));
    List.add(new NameValuePair("HardStamp","4266F7C76935130C21C10F17D74C9E59424556816224276600032831"));
    List.add(new NameValuePair("Licex", "Ajg1QzI1REJERjU2NzcyMzM4MzMwMTc0Nzk0RTFFNEZEMDE5OTc5NjYwMDM2MTk4OTkwMDAxNzAwMwAAAAAAAABNWSx6LuvvW6CsBXlP8xJ*vVTBq8fSvK9PV4fbZ3Mh*rLchioqmgYeJroAn5WfPG9k0wpi*3-zPp4jdFapx63wyOZCPC---tOfcIDDE2xNNB9Ck6wMNS5l*IqwOQzc6MiwBmv2VySz**CGbvectO-*r9BdDoAF9z2ZjX6R6T9ZL-MaKD1RCgRLtbsneuw1Nr8F7ORkEWrWRFVHmT2Bw0CsEUTQKiGSJ4fYaU2gtirJl0EEkfCbShkoPCYgJ9TmK4MT1NsrEo917nK3Jsb3uHwDcd7Iiemoze0wvVwJmHaueLYKgVZRlhfpcDtYIFjc5QNU*rQj8epLEkASqChNLBSSj97aE5GUOw8S3B6igOMBRotwYTTDkTZ-GJH9Wy2-Q9gLXQbVHGDTnfzTXek4Eiqxwq-47a0gDHILl0x9AA__"));
    webRequest.setHttpMethod(HttpMethod.POST);  
    webRequest.setRequestParameters(List);
    //webRequest.setAdditionalHeader("asd", "asd");
    webClient.addRequestHeader("Content-Type","application/x-www-form-urlencoded");
    webClient.addRequestHeader("Referer","https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/Login.aspx");
    webClient.addRequestHeader("Origin","https://pbsz.ebank.cmbchina.com");
    webClient.addRequestHeader("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30");
      Set<Cookie> cookies = webClient.getCookieManager().getCookies();;   

         for (Cookie c : cookies) {  
          webClient.getCookieManager().addCookie(c);

         }  http://ask.csdn.net/?ref=toolbar#
    HtmlPage page= webClient.getPage(webRequest);
    System.out.println(page.asXml());
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问