- 浏览: 202990 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
jccmjl:
1222222222222222
htmlunit分页爬去数据实现 -
jccmjl:
os586 写道attr("checked" ...
jquery根据对象选中 radio 和select -
os586:
attr("checked",true); ...
jquery根据对象选中 radio 和select
package com.htmlunit.sky;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.CollectingAlertHandler;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlDivision;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
/**
* 运用htmlUnit爬网页
*
* @author liming
*/
public class SkyHtmlUnit {
// 充值密码
private static final String transPassword = "XXXX";
// 用户名
private static final String userName = "xxx";
// 密码
private static final String userPassword = "XXXX";
/**
* 充值
*
* @param transNumber
* 被充值用户号码
* @param transAmount
* 充值金额
*/
public static boolean recharge(String transNumber, String transAmount) {
boolean bool = false;
try {
BigDecimal b = new BigDecimal(transAmount);
b = b.setScale(0, BigDecimal.ROUND_DOWN);
WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
List<String> collectedAlerts = new ArrayList<String>();
client.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
HtmlPage page1 = (HtmlPage) client
.getPage("http://XXX/vams/");
HtmlForm form = (HtmlForm) page1.getForms().get(0);
HtmlTextInput username = (HtmlTextInput) form
.getInputByName("login:userName");
HtmlPasswordInput password = (HtmlPasswordInput) form
.getInputByName("login:password");
username.setValueAttribute(userName);
password.setValueAttribute(userPassword);
form.getInputByName("login:j_id_jsp_28762255_4").click();
client.setJavaScriptEnabled(true);
String Recharge = "http://XXX/vams/WebPay/WebTrans.faces";
HtmlPage Recharge1 = (HtmlPage) client.getPage(Recharge);
HtmlForm RechargeForm = (HtmlForm) Recharge1.getForms().get(0);
HtmlTextInput number = (HtmlTextInput) RechargeForm
.getInputByName("webPayment:transNumber");
HtmlTextInput transAmountt = (HtmlTextInput) RechargeForm
.getInputByName("webPayment:transAmount");
HtmlPasswordInput transPass = (HtmlPasswordInput) RechargeForm
.getInputByName("webPayment:transPassword");
// 设置充值密码
transPass.setValueAttribute(transPassword);
// 设置充值金额
transAmountt.setValueAttribute(b.toString());
// 设置充值号码
number.setValueAttribute(transNumber);
RechargeForm.getInputByName("webPayment:j_id_jsp_427518967_10")
.click();
String returnvalue = collectedAlerts.get(0);
if (returnvalue.equals("充值成功!")) {
bool = true;
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("**********充值结束*******");
return bool;
}
/**
* 充值结果查询
*
* @param payNoValue
* 充值号码
* @param beforeTime
* 充值时间前 格式YYYYMMdd
* @param afterTime
* 充值时间后 格式YYYYMMdd
* @param rechargeAmount
* 充值金额
* @throws ParseException
*/
public static List<RechargeBean> getRechargeList(String payNoValue,
String beforeTime, String afterTime, String rechargeAmount
) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat formatX = new SimpleDateFormat("yyyy/MM/dd");
String beforeT = "";
String afterT = "";
if (beforeTime != null && !afterTime.equals("")) {
beforeT = formatX.format(format.parse(beforeTime));
}
if (afterTime != null && !afterTime.equals("")) {
afterT = formatX.format(format.parse(afterTime));
}
// 存储集合
List<RechargeBean> list = new ArrayList<RechargeBean>();
try {
WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
HtmlPage page1 = (HtmlPage) client
.getPage("http://XXX/vams/");
HtmlForm form = (HtmlForm) page1.getForms().get(0);
HtmlTextInput username = (HtmlTextInput) form
.getInputByName("login:userName");
HtmlPasswordInput password = (HtmlPasswordInput) form
.getInputByName("login:password");
username.setValueAttribute(userName);
password.setValueAttribute(userPassword);
form.getInputByName("login:j_id_jsp_28762255_4").click();
client.setJavaScriptEnabled(true);
String Recharge = "http://XXX/vams/WebPay/WebPaySearch.faces?showType=2";
HtmlPage Recharge1 = (HtmlPage) client.getPage(Recharge);
HtmlForm rechargeForm = (HtmlForm) Recharge1.getForms().get(0);
// 充值号码
HtmlTextInput payNo = (HtmlTextInput) rechargeForm
.getInputByName("form1:payNo");
payNo.setValueAttribute(payNoValue);
// 充值时间:
HtmlTextInput j_id_jsp_1155368641_9 = (HtmlTextInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_9");
j_id_jsp_1155368641_9.setValueAttribute(beforeT);
HtmlTextInput j_id_jsp_1155368641_11 = (HtmlTextInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_11");
j_id_jsp_1155368641_11.setValueAttribute(afterT);
// 充值金额
HtmlTextInput j_id_jsp_1155368641_13 = (HtmlTextInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_13");
j_id_jsp_1155368641_13.setValueAttribute(rechargeAmount);
// button
HtmlSubmitInput button1 = (HtmlSubmitInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_32");
HtmlPage page12 = (HtmlPage) button1.click();
HtmlForm aa = page12.getForms().get(0);
int divSize = aa.getByXPath("//div[@id='zhu1']").size();
if (divSize > 1) {
HtmlDivision div = (HtmlDivision) aa.getByXPath(
"//div[@id='zhu1']").get(1);
String aad = div.asText();
int pageNumber = (Integer
.parseInt(aad.split("共")[2].split("页")[0].trim()));
Map<String, String[]> map = new HashMap<String, String[]>();
int key = 1;
for (int i = 0; i < pageNumber; i++) {
if (i == 0) {
DomNodeList<HtmlElement> tables = page12
.getElementsByTagName("table");
final HtmlTable table = (HtmlTable) tables.get(tables
.size() - 1);
for (final HtmlTableRow row : table.getBodies().get(0).getRows()) {
String[] alertPring = new String[7];
int d = 0;
for (final HtmlTableCell cell : row.getCells()) {
alertPring[d] = cell.asText();
d++;
}
map.put(key +"", alertPring);
key++;
}
} else {
HtmlPage ahtmpr = div.getHtmlElementsByTagName("a")
.get(3).click();
DomNodeList<HtmlElement> tables2 = ahtmpr
.getElementsByTagName("table");
final HtmlTable table = (HtmlTable) tables2.get(tables2
.size() - 1);
for (final HtmlTableRow row : table.getBodies().get(0)
.getRows()) {
String[] alertPring = new String[7];
int d = 0;
for (final HtmlTableCell cell : row.getCells()) {
alertPring[d] = cell.asText();
d++;
}
map.put(key +"", alertPring);
key++;
}
}
}
Set<String> keyV = map.keySet();
Iterator<String> it2 = keyV.iterator();
while (it2.hasNext()) {
RechargeBean bean = new RechargeBean();
String[] values = map.get(it2.next());
for (int i = 0; i < values.length; i++) {
bean.setId(values[0]);
bean.setDate(values[1]);
bean.setNumber(values[2]);
bean.setAmount(values[3]);
bean.setaType(values[4]);
bean.setsType(values[5]);
bean.setCgType(values[6]);
}
list.add(bean);
}
}
System.out.println("********充值结果查询结束***********");
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
/**
* 返回代理商余额
*/
public static String getBalance() {
String balance = "";
try {
WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
HtmlPage page1 = (HtmlPage) client
.getPage("http://XXX/vams/");
HtmlForm form = (HtmlForm) page1.getForms().get(0);
HtmlTextInput username = (HtmlTextInput) form
.getInputByName("login:userName");
HtmlPasswordInput password = (HtmlPasswordInput) form
.getInputByName("login:password");
username.setValueAttribute(userName);
password.setValueAttribute(userPassword);
form.getInputByName("login:j_id_jsp_28762255_4").click();
client.setJavaScriptEnabled(true);
String Recharge = "http://XXX/vams/WebPay/WebPayRemainSearch.faces";
HtmlPage Recharge1 = (HtmlPage) client.getPage(Recharge);
HtmlForm rechargeForm = (HtmlForm) Recharge1.getForms().get(0);
// button按钮请求
HtmlSubmitInput button1 = (HtmlSubmitInput) rechargeForm
.getInputByName("j_id_jsp_1894475275_1:j_id_jsp_1894475275_32");
HtmlPage page3 = (HtmlPage) button1.click();
DomNodeList<HtmlElement> tables = page3
.getElementsByTagName("table");
final HtmlTable table = (HtmlTable) tables.get(tables.size() - 1);
for (final HtmlTableRow row : table.getBodies().get(0).getRows()) {
int i = 0;
for (final HtmlTableCell cell : row.getCells()) {
if (i == 7) {
HtmlPage page = cell.getHtmlElementsByTagName("a").get(
0).click();
DomNodeList<HtmlElement> pagezhu = (DomNodeList<HtmlElement>) page
.getElementById("zhu1").getElementsByTagName(
"td");
for (int j = 1; j < pagezhu.getLength(); j++) {
balance = pagezhu.get(1).asText();
}
}
i++;
}
}
System.out.println("*************代理商余额查询结束***********");
} catch (Exception e) {
e.printStackTrace();
}
return balance;
}
public static void main(String[] args) throws ParseException {
// 充值结果查询
// 201120619
List<RechargeBean> list = getRechargeList("", "", "", "");
for (int i = 0; i < list.size(); i++) {
RechargeBean bean = list.get(i);
System.out.println(bean.getDate());
}
// getRechargeList("", "", "", "", "");
// 查询余额
// System.out.println(getBalance());
// 进行充值
// System.out.println(recharge("18911019001", ""));
}
}
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.CollectingAlertHandler;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlDivision;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
/**
* 运用htmlUnit爬网页
*
* @author liming
*/
public class SkyHtmlUnit {
// 充值密码
private static final String transPassword = "XXXX";
// 用户名
private static final String userName = "xxx";
// 密码
private static final String userPassword = "XXXX";
/**
* 充值
*
* @param transNumber
* 被充值用户号码
* @param transAmount
* 充值金额
*/
public static boolean recharge(String transNumber, String transAmount) {
boolean bool = false;
try {
BigDecimal b = new BigDecimal(transAmount);
b = b.setScale(0, BigDecimal.ROUND_DOWN);
WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
List<String> collectedAlerts = new ArrayList<String>();
client.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
HtmlPage page1 = (HtmlPage) client
.getPage("http://XXX/vams/");
HtmlForm form = (HtmlForm) page1.getForms().get(0);
HtmlTextInput username = (HtmlTextInput) form
.getInputByName("login:userName");
HtmlPasswordInput password = (HtmlPasswordInput) form
.getInputByName("login:password");
username.setValueAttribute(userName);
password.setValueAttribute(userPassword);
form.getInputByName("login:j_id_jsp_28762255_4").click();
client.setJavaScriptEnabled(true);
String Recharge = "http://XXX/vams/WebPay/WebTrans.faces";
HtmlPage Recharge1 = (HtmlPage) client.getPage(Recharge);
HtmlForm RechargeForm = (HtmlForm) Recharge1.getForms().get(0);
HtmlTextInput number = (HtmlTextInput) RechargeForm
.getInputByName("webPayment:transNumber");
HtmlTextInput transAmountt = (HtmlTextInput) RechargeForm
.getInputByName("webPayment:transAmount");
HtmlPasswordInput transPass = (HtmlPasswordInput) RechargeForm
.getInputByName("webPayment:transPassword");
// 设置充值密码
transPass.setValueAttribute(transPassword);
// 设置充值金额
transAmountt.setValueAttribute(b.toString());
// 设置充值号码
number.setValueAttribute(transNumber);
RechargeForm.getInputByName("webPayment:j_id_jsp_427518967_10")
.click();
String returnvalue = collectedAlerts.get(0);
if (returnvalue.equals("充值成功!")) {
bool = true;
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("**********充值结束*******");
return bool;
}
/**
* 充值结果查询
*
* @param payNoValue
* 充值号码
* @param beforeTime
* 充值时间前 格式YYYYMMdd
* @param afterTime
* 充值时间后 格式YYYYMMdd
* @param rechargeAmount
* 充值金额
* @throws ParseException
*/
public static List<RechargeBean> getRechargeList(String payNoValue,
String beforeTime, String afterTime, String rechargeAmount
) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat formatX = new SimpleDateFormat("yyyy/MM/dd");
String beforeT = "";
String afterT = "";
if (beforeTime != null && !afterTime.equals("")) {
beforeT = formatX.format(format.parse(beforeTime));
}
if (afterTime != null && !afterTime.equals("")) {
afterT = formatX.format(format.parse(afterTime));
}
// 存储集合
List<RechargeBean> list = new ArrayList<RechargeBean>();
try {
WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
HtmlPage page1 = (HtmlPage) client
.getPage("http://XXX/vams/");
HtmlForm form = (HtmlForm) page1.getForms().get(0);
HtmlTextInput username = (HtmlTextInput) form
.getInputByName("login:userName");
HtmlPasswordInput password = (HtmlPasswordInput) form
.getInputByName("login:password");
username.setValueAttribute(userName);
password.setValueAttribute(userPassword);
form.getInputByName("login:j_id_jsp_28762255_4").click();
client.setJavaScriptEnabled(true);
String Recharge = "http://XXX/vams/WebPay/WebPaySearch.faces?showType=2";
HtmlPage Recharge1 = (HtmlPage) client.getPage(Recharge);
HtmlForm rechargeForm = (HtmlForm) Recharge1.getForms().get(0);
// 充值号码
HtmlTextInput payNo = (HtmlTextInput) rechargeForm
.getInputByName("form1:payNo");
payNo.setValueAttribute(payNoValue);
// 充值时间:
HtmlTextInput j_id_jsp_1155368641_9 = (HtmlTextInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_9");
j_id_jsp_1155368641_9.setValueAttribute(beforeT);
HtmlTextInput j_id_jsp_1155368641_11 = (HtmlTextInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_11");
j_id_jsp_1155368641_11.setValueAttribute(afterT);
// 充值金额
HtmlTextInput j_id_jsp_1155368641_13 = (HtmlTextInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_13");
j_id_jsp_1155368641_13.setValueAttribute(rechargeAmount);
// button
HtmlSubmitInput button1 = (HtmlSubmitInput) rechargeForm
.getInputByName("form1:j_id_jsp_1155368641_32");
HtmlPage page12 = (HtmlPage) button1.click();
HtmlForm aa = page12.getForms().get(0);
int divSize = aa.getByXPath("//div[@id='zhu1']").size();
if (divSize > 1) {
HtmlDivision div = (HtmlDivision) aa.getByXPath(
"//div[@id='zhu1']").get(1);
String aad = div.asText();
int pageNumber = (Integer
.parseInt(aad.split("共")[2].split("页")[0].trim()));
Map<String, String[]> map = new HashMap<String, String[]>();
int key = 1;
for (int i = 0; i < pageNumber; i++) {
if (i == 0) {
DomNodeList<HtmlElement> tables = page12
.getElementsByTagName("table");
final HtmlTable table = (HtmlTable) tables.get(tables
.size() - 1);
for (final HtmlTableRow row : table.getBodies().get(0).getRows()) {
String[] alertPring = new String[7];
int d = 0;
for (final HtmlTableCell cell : row.getCells()) {
alertPring[d] = cell.asText();
d++;
}
map.put(key +"", alertPring);
key++;
}
} else {
HtmlPage ahtmpr = div.getHtmlElementsByTagName("a")
.get(3).click();
DomNodeList<HtmlElement> tables2 = ahtmpr
.getElementsByTagName("table");
final HtmlTable table = (HtmlTable) tables2.get(tables2
.size() - 1);
for (final HtmlTableRow row : table.getBodies().get(0)
.getRows()) {
String[] alertPring = new String[7];
int d = 0;
for (final HtmlTableCell cell : row.getCells()) {
alertPring[d] = cell.asText();
d++;
}
map.put(key +"", alertPring);
key++;
}
}
}
Set<String> keyV = map.keySet();
Iterator<String> it2 = keyV.iterator();
while (it2.hasNext()) {
RechargeBean bean = new RechargeBean();
String[] values = map.get(it2.next());
for (int i = 0; i < values.length; i++) {
bean.setId(values[0]);
bean.setDate(values[1]);
bean.setNumber(values[2]);
bean.setAmount(values[3]);
bean.setaType(values[4]);
bean.setsType(values[5]);
bean.setCgType(values[6]);
}
list.add(bean);
}
}
System.out.println("********充值结果查询结束***********");
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
/**
* 返回代理商余额
*/
public static String getBalance() {
String balance = "";
try {
WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
HtmlPage page1 = (HtmlPage) client
.getPage("http://XXX/vams/");
HtmlForm form = (HtmlForm) page1.getForms().get(0);
HtmlTextInput username = (HtmlTextInput) form
.getInputByName("login:userName");
HtmlPasswordInput password = (HtmlPasswordInput) form
.getInputByName("login:password");
username.setValueAttribute(userName);
password.setValueAttribute(userPassword);
form.getInputByName("login:j_id_jsp_28762255_4").click();
client.setJavaScriptEnabled(true);
String Recharge = "http://XXX/vams/WebPay/WebPayRemainSearch.faces";
HtmlPage Recharge1 = (HtmlPage) client.getPage(Recharge);
HtmlForm rechargeForm = (HtmlForm) Recharge1.getForms().get(0);
// button按钮请求
HtmlSubmitInput button1 = (HtmlSubmitInput) rechargeForm
.getInputByName("j_id_jsp_1894475275_1:j_id_jsp_1894475275_32");
HtmlPage page3 = (HtmlPage) button1.click();
DomNodeList<HtmlElement> tables = page3
.getElementsByTagName("table");
final HtmlTable table = (HtmlTable) tables.get(tables.size() - 1);
for (final HtmlTableRow row : table.getBodies().get(0).getRows()) {
int i = 0;
for (final HtmlTableCell cell : row.getCells()) {
if (i == 7) {
HtmlPage page = cell.getHtmlElementsByTagName("a").get(
0).click();
DomNodeList<HtmlElement> pagezhu = (DomNodeList<HtmlElement>) page
.getElementById("zhu1").getElementsByTagName(
"td");
for (int j = 1; j < pagezhu.getLength(); j++) {
balance = pagezhu.get(1).asText();
}
}
i++;
}
}
System.out.println("*************代理商余额查询结束***********");
} catch (Exception e) {
e.printStackTrace();
}
return balance;
}
public static void main(String[] args) throws ParseException {
// 充值结果查询
// 201120619
List<RechargeBean> list = getRechargeList("", "", "", "");
for (int i = 0; i < list.size(); i++) {
RechargeBean bean = list.get(i);
System.out.println(bean.getDate());
}
// getRechargeList("", "", "", "", "");
// 查询余额
// System.out.println(getBalance());
// 进行充值
// System.out.println(recharge("18911019001", ""));
}
}
相关推荐
htmlunit网络爬虫jar包
htmlunit爬虫,基于Javahtmlunit爬虫,模拟浏览器HTTP请求实现对网页信息的抓取,本人经常用的框架,可以爬网上一些数据,进行分析。
使用htmlnit爬取网页源码并解析,可动态执行js。参数设置
HtmlUnit 爬虫Demo,有最全面的方法
高效的java爬虫,内附... 有htmlunit的各种获取标签的方法。避免了jsoup无法抓取js代码生成的数据内容的弊端。避免了client无法一次性获取大量信息的弊端。有能获取静态页面形成之前的对方数据内容的高手 欢迎借阅指导
导致htmlunit无法直接感知到需要等待Kissy发起的请求完成,通过等待页面加载解析内容判断处理实现此类页面数据抓取。 基于页面滚动的AJAX请求页面抓取: 诸如淘宝/天猫的商品详情页面会基于页面滚动发起...
完整项目,htmlunit爬取数据转储excel,直接导入eclipse即可使用
htmlunit2.8 + jsoup1.7各种网站上的数据抓取。
htmlunit 网络爬虫,及其依赖jar包。以及实例 没有积分,赚点积分,:-D
使用htmlunit技术对网站上的数据进行抽取分析等
htmlunit jar zip 2.23 用于html爬虫
htmlUnit所需工具包,htmlUnit,htmlUnit,htmlUnit,htmlUnit,htmlUnit
htmlunit爬虫工具,Java所需的依赖jar包,凑够50个字符
爬虫通常由搜索引擎、数据挖掘工具、监测系统等应用于网络数据抓取的场景。 爬虫的工作流程包括以下几个关键步骤: URL收集: 爬虫从一个或多个初始URL开始,递归或迭代地发现新的URL,构建一个URL队列。这些URL...
htmlunit爬取网站的数据并保存成Excel表格
htmlunit-2.14 jar包htmlunit爬去js加载后的页面特表好用
htmlunit2.8.jar
htmlunit 模拟cookie 存取 cookie值登录 如: wsyyuser.xywy.com Cookie c = new Cookie("wsyyuser.xywy.com", "PHPSESSID", Common.getValue("session_id") );
htmlunit-2.1.5的源码,可以提高我们对htmlunit的理解