How to get a JSObject or JSContext to run an applet from Java?
I'm trying to automate some procedure that consists in some link clicking in a web and then going through an applet, so what I do is to send some HTTPRequests through Java until I get a HTML with the tag from which, through JSoup, I extract all the parameters and codebase, etc. As I want to run the applet as well, I load the applet class with a ClassLoader, I set a custom stub that can give the parameters that I extracted previously.
The thing is that this applet has some javascript interaction with the browser, so at some point it does a JSObject.getWindow(applet) to get the document and make the js calls and here is where I'm stuck. I understand that I have to be able to provide an AppletContext which should implement a JSContext and be able to provide this JSObject that it's the window as the browser would provide it. But is it possible to mock such a thing?