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
- Java API for the Web Browser
- Java API for the HTML Parser
The Web Browser API is sufficient for automating the
navigation, and parsing the resultant HTML can be conveniently
done using the HTML parser API.
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.
Sample Programs
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.
SimpleController.java |
|
Command line controller for IE. Starts an instance of IE, and invokes API methods
on it in response to command line input.
|
StockQuote.java |
|
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.
|
Spider.java |
|
Given a URL and a depth (an
integer value), spiders all the links on the web-site recursively to
the specified depth.
|
PostData.java |
|
Shows how to POST
data using the IE Java API.
|
JavaScriptSample.java |
|
Shows how to call JavaScript functions in a loaded web page.
|
ActiveXSample.java |
|
Shows how to access ActiveX controls in a loaded web page.
|
WebFrame.java |
|
Shows how to embed
Internet Explorer visually in a Swing JPanel.
|
TreeWalk.java |
|
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
|