Automating Internet Explorer from Java using EZ JCom
Internet Explorer can be automated using the Java API built
by EZ JCom. There are two components involved
The Web Browser API is sufficient for automating the
navigation, and parsing the resultant HTML can be conveniently
done using the HTML parser API.
- Java API for the Web Browser
- Java API for the HTML Parser
These APIs can be built using EZ JCom,
just like the Java API for any other COM application.
But the HTML Parser API is extremely huge. Therefore
a pre-built package for Internet Explorer is provided,
including sample programs. Those interested in automating
Internet Explorer from Java should download
this pre-packaged version instead of using the tool directly.
Following are some brief Internet Explorer sample programs (also included in
the pre-packaged version.) Following the samples,
is a guideline explaining the programming steps.
||Command line controller for IE. Starts an instance of IE, and invokes API methods
on it in response to command line input.
||Uses IE to obtain
stock quotes from several different web-sites. Shows
- how to wait
for a web-site to fully load, and
- ad-hoc parsing of web-sites to
retrieve a data item of interest.
||Given a URL and a depth (an
integer value), spiders all the links on the web-site recursively to
the specified depth.
||Shows how to POST
data using the IE Java API.
||Shows how to access ActiveX controls in a loaded web page.
||Shows how to embed
Internet Explorer visually in a Swing JPanel.
||Walks the tree structure of an HTML document using MSHTML, and displays
the structure in a JTree.
In addition, the files WebLoadListener.java
and WebEventsAdapter.java provide
supporting classes for use by these samples.
Image of an instance of Internet Explorer embedded within
a Swing UI:
General Hints for programming with the Internet Explorer Java API