HtmlUnit. Map <object> tag to custom java class

204 views Asked by At

I am using HtmlUnit and I am trying to provide custom implementation for ActiveXObjects. Although I can provide custom implementation when an ActiveObject is called through javascript by name e.g.

var wmi = new ActiveXObject("WMPlayer.OCX.7");

I cannot do the same when the object is declared with its classid like

<object id="PlayerEx2" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="200" width="200">

I have found these threads http://comments.gmane.org/gmane.comp.java.htmlunit.general/3894 and http://sourceforge.net/p/htmlunit/bugs/691/ that describe the same problem.

Also it appears that it can be done using

client.setHtmlObjectMap(htmlObjectToJavaMapping);

however, I am using htmlunit 2.13 and I cannot find this method.

Additionally I know that i could use jacob (java-com bridge) but jacob communicates with existing/installed com-objects. I wish to provide my own mock implementations.

I could not find any other information on the subject. Could you please guide me on how this could be done?

0

There are 0 answers