Drive an Applet without using robot class ?

P

prak

Hi, Is there a way to drive an applet from a different url and scrape
data from it without using the java.awt.robot class? Basically what I
am looking for is to get the content out of an applet (screen
scraping). I am using java.awt.robot class, but it will take control
of your mouse and keyboard so we will not be able to runmultiple
requests at the same time. This is a third-party applet we want to
grab the content from. So we don't have control over that applet, but
need to get the content out of it when it executes. Any help
appreciated.
 
P

prak

Andrew Thompson said:
What URL?

Let's say for example I have this html
http://java.sun.com/docs/books/tutorial/getStarted/index.html which
includes applet in it. Let's assume that this applet prints some data
like "hello world".
Now I write my own code to parse this html file and grab applet and
get to the content which is "html world". I can't use browser, I
should get to this content through the code may be like a String or
something. Any ideas ?
 
M

mromarkhan

Peace be unto you.
Maybe this example is extremely basic for your problem,
but here is a guess anyway.

I visited
http://java.sun.com/docs/books/tutorial/applet/overview/lifeCycle.html

I looked for Simple.class in the HTML document
<applet code="Simple.class" codebase=example-1dot1/ width=500 height=20>

I downloaded the class
http://java.sun.com/docs/books/tutorial/applet/overview/example-1dot1/Simple.class

I inspected it
C:\WINDOWS\Desktop>javap Simple
Compiled from "Simple.java"
public class Simple extends java.applet.Applet{
java.lang.StringBuffer buffer;
public void init();
public void start();
public void stop();
public void destroy();
void addItem(java.lang.String);
public void paint(java.awt.Graphics);
public Simple();
}

I wrote a companion class
class RunApplet
{
public static void main(String [] s)
{
Simple app = new Simple();
app.init();
app.start();
System.out.println("The text : " + app.buffer);
}
}


Output
java RunApplet
initializing...
starting...
The text : initializing... starting...
Exit code: 0

Have a Good Day.
 
A

Andrew Thompson

Let's say for example I have this html ..

Let's say for example you answer the question
asked, what it is the URL where the applet resides?
Until we know that, it is all just guesses.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top