The most important features are:
- Single thread for background JavaScript execution
- Large (binary) download
- Can be used on Google App Engine
- Support for SOCKS proxy (even at request-level)
- Migration to HttpClient 4
- And as usual, various bug fixes
You can download it here, enjoy!
2 comments:
HtmlUnit is one of the most useful tools I have ever used. There is not even one tool for automating web related tasks which comes even close to being as good. Honestly, I can't imagine donig my work without HtmlUnit.
Ahmed, and the rest of the HtmlUnit team, I really appeciate your hard work. Hopefully soon, I'll pay my debt to you for all that you have provided for us.
Hi ahmed,
I am trying to read html from url using, but I am getting script exception
Below is my code.
--Regards RekhaVedi
package com.sample.htmlunit;
import java.io.IOException; import java.net.MalformedURLException; import java.net.URL;
import com.gargoylesoftware.htmlunit. AjaxController; import com.gargoylesoftware.htmlunit. BrowserVersion; import com.gargoylesoftware.htmlunit. DefaultCredentialsProvider; import com.gargoylesoftware.htmlunit. FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit. NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit. WebClient; import com.gargoylesoftware.htmlunit. WebRequest; import com.gargoylesoftware.htmlunit. html.HtmlPage;
public class HtmlUnitSample {
public static void main(String[] args) throws InterruptedException, FailingHttpStatusCodeException, IOException {
WebClient webClient = new WebClient(BrowserVersion. INTERNET_EXPLORER_7,"10.81.124.2", 80); webClient.setJavaScriptEnabled(true); webClient. setThrowExceptionOnScriptError(false); webClient.setAjaxController(new NicelyResynchronizingAjaxController());
WebRequest request; try { webClient.setAjaxController(new AjaxController(){ /** * */private static final long serialVersionUID = 1L;
@Override public boolean processSynchron(HtmlPage page, WebRequest request, boolean async) { return true; } }); final DefaultCredentialsProvider credentialsProvider = (DefaultCredentialsProvider) webClient. getCredentialsProvider(); credentialsProvider. addCredentials("username", "passwd"); request = new WebRequest(new URL("http://www.ti.com/product/opa333")); HtmlPage page = webClient.getPage(request); int i = webClient. waitForBackgroundJavaScript(5);
while (i > 0) { i = webClient. waitForBackgroundJavaScript(5);
if (i == 0) { break; } synchronized (page) { System.out.println("wait"); //page.wait(10); } }
webClient.getAjaxController(). processSynchron(page, request, false);
System.out.println(page. toString());
} catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }
}
}
Exeptiib.cannot set peoperty innerhtml of null
Post a Comment