htmlunit 模拟登陆 https

public static void htmlUnitUrl(String url, String ip, String port)
			throws Exception {
		WebClient client=null;
		try {
			 client = new WebClient(BrowserVersion.FIREFOX_24,ip,Integer.valueOf(port));  
	         client.getOptions().setUseInsecureSSL(true);
	         client.getOptions().setCssEnabled(false);
	         client.getOptions().setJavaScriptEnabled(false);
	        //获取某网站页面  
	        HtmlPage page = client.getPage(url); 
		} catch (Exception e) {
			logger.error("激活连接出错", e);
		} finally {
			if(client!=null){
				client.closeAllWindows();
			}
		}
	}

 

你可能感兴趣的:(htmlunit 模拟登陆 https)