这是代码。我正在尝试使用 htmlunit 进行网页抓取。这只是“hello world”类型的程序。我无法执行它。
import java.io.IOException;
import java.net.MalformedURLException;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class test1 {
public static void main() throws FailingHttpStatusCodeException,
MalformedURLException, IOException {
WebClient abc=new WebClient();
HtmlPage page =abc.getPage("http://google.com");
String a= page.asText();
System.out.print(a);
}
}