Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Read Html Page Opened In Browser Using Java Program

 
panadare aniruddha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

rc
 
Mark Guo
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Leonardo Shikida
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the idea is to scrap some site, you can make your life easier using httpunit + xpath

TIA

Leo K.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic