This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes How To Read Html Page Opened In Browser Using Java Program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How To Read Html Page Opened In Browser Using Java Program" Watch "How To Read Html Page Opened In Browser Using Java Program" New topic

How To Read Html Page Opened In Browser Using Java Program

panadare aniruddha

Joined: Feb 06, 2011
Posts: 3

I am trying to develop a Java Application that will read a html page opend in browser
Suppose a opened page in browser is Page containing a Profile no. and Registration no. i want to read only those no.
Bert Bates

Joined: Oct 14, 2002
Posts: 8801
I'm not sure exactly where this question should go, but it's definitely not in the SCJP forum

We'll try Java in General, but I wouldn't be surprised if it gets bounced again...

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60752

I do not believe that there is any way that an independently running Java program can query a browser for its displayed contents. Or are you talking about an Applet running within the context of the page?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
Or are you talking about a java program that uses the URL string that one would put in a browser to obtain the same page as the browser would get, but inspects it to do something different than the browser would do (like extract certain data from the page).

I've written a program like this to "crawl" through some pages on a site to get some specific information that I wanted without having to visit all the sites. In case you're a little vague on how this works, the java program makes a socket connection to the server by using the same URL you would use in the browser address window, and gets back through that socket everything the browser would get. It is up to the java program to do whatever it wants to do with it, and also up to the program to skip everything that needs to be skipped.

Mark Guo
Ranch Hand

Joined: Nov 17, 2010
Posts: 58
Leonardo Shikida

Joined: Jan 02, 2003
Posts: 29
if the idea is to scrap some site, you can make your life easier using httpunit + xpath


Leo K.
I agree. Here's the link:
subject: How To Read Html Page Opened In Browser Using Java Program
Similar Threads
Urgent. Pagination in word
Problem getting the Beer Selection Page screen shot
Sun Java VM in IE
requesting a web page through httpclient
Embedding a applet in my website