Link to home
Start Free TrialLog in
Avatar of forloop
forloop

asked on

I need to access a complex website (Javascript/Frames) from Java

I'm writing a testing tool that needs to POST some data into a complex website. Then based on the data posted it will take care of the rest. Results will be delivered back out to me when processing is done (via an external servlet call).

The problem is that the website uses FRAMESET's and has a ton of javascript (none of which I care about). When I access the website with javascript disbled, I get nothing. Apparently the website interacts with each of these frames to pass information to/form the main servlet. At any rate, the website belongs to our partner and I don't have the source code or enough knowledge to bypass that stuff, so I'm assuming I'll have to interact with it through a full web browser like Mozilla, IE, etc instead of using Java's URL like I had planned on.

This tool is to be run on a Solaris server (with no graphics card) and so anything I do needs to be aware of that.

My thoughts so far:
1. Call Mozilla from the commandline with an html file which will post the data. Problems: I would need to do this hundreds of times (hopefully in parallel), I don't know how to reuse a browser that is currently available (from unix), it needs a DISPLAY (X-Windows) and I'm worried about the performance and reliability of this solution.
2. Maybe there's an API out there that can handle framesets and javascript that can be used similarily to URL? (this should be faster and easier to use)
3. Something else I can't think of.

I'd appreciate any API's, code snippets or ideas that would help with this problem.

ASKER CERTIFIED SOLUTION
Avatar of tomboshell
tomboshell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of forloop
forloop

ASKER

girions: I don't care of about the javascript, but it directs the servlet to start processing the data. If I knew exactly what the javascript sends to servlet I could immitate that. But I don't and there's thousands of lines of javascript.
Avatar of forloop

ASKER

tomboshell: I believe you thought I needed to create or get an entire testing suite. The testing tool has already been written. It's hooked up inside this website. If I can get a tool that process a bit of javascript, I'm good.

This is a tough problem mainly becuase I need something no one really cares about: a full web browser with no gui, preferable in the form of a Java api.

>  girions: I don't care of about the javascript, but it directs the servlet to start processing the data.

Where? And does it also send parameters with the redirection? YOu can just fidnm the url it redirects to and the parameters it sends and then simulate the call.
Can yuou give us an url of relevant pages in that partnersite. Out of thoes "tons of Javascript" most likely only a few lines are relvant to you problem. We can find and explain those lines.

PS: This appear to be a JavaScript question more than a Java question.

regards JakobA