一切福田,不離方寸,從心而覓,感無不通。

htmlunit模拟登录

PS:我只用到了这一句

webClient.getOptions().setThrowExceptionOnScriptError(false);

htmlunit jar项目路径http://sourceforge.net/projects/htmlunit/files/htmlunit/

demo代码如下

搞不清ASP.NET内部什么逻辑,试了很多方法都不行,查看了无所网站,无意中看到一个这个配置http://stackoverflow.com/questions/20352284/scraping-aspx-page-using-htmlunit

最后测试下来,如果不加 webClient.getOptions().setThrowExceptionOnScriptError(false);就一直报这个错误

希望能帮助到你,晚安!

 

from:https://www.cnblogs.com/yimu/p/LOVE_HCJ.html