Although HtmlUnit is a pure Java implementation that simulates browsers, there are some cases where platform-specific features require integration of other libraries, and ActiveX is one of them.

Internet Explorer on Windows can run arbitrary ActiveX components (provided that security level is lowered on purpose, if the user trusts the website). Neither HtmlUnit nor Internet Explorer has any control on the behavior of the run ActiveX, so you have to be careful before using that feature.


The current implementation depends on Jacob, and because it has .dll dependency, it was not uploaded to maven repository. The dependency is optional, i.e. Jacob jar is not needed for compiling or usual usage of HtmlUnit.

To use Jacob, add jacob.jar to the classpath and put the .dll in the path (java.library.path) so that the following code works for you:

final ActiveXComponent activeXComponent = new ActiveXComponent("InternetExplorer.Application");
final boolean busy = activeXComponent.getProperty("Busy").getBoolean();

Permit HtmlUnit to use ActiveX

The only thing needed is setting WebClient property:


and there you go!