Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

is it possible to load a web page into a browser, and then shut the browser when loaded?

Posted on 2010-09-16
10
Medium Priority
?
411 Views
Last Modified: 2013-12-29
I would like to use Java to open firefox and load a web page into it.  once the page finishes loading, i would like to end firefox.  how would i do this?  

opening firefox from java is easy, and executing a kill command to stop firefox is easy too.  but how would i find out when the page finishes loading?
0
Comment
Question by:trip008vk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 33694701
<<but how would i find out when the page finishes loading?>>
I dont think you can do this in java. Since after starting the browser, for your java program the task is completed, and control is no longer with your java program. After which firefox process cannot send any signal or interrupts to your java program.

You need to check if there is any command, which can tell given a browser's PID, what are the pages loaded and their status
0
 
LVL 3

Expert Comment

by:alanpetersen
ID: 33696880
Why are you trying to do this? If you simply want to hit a URL, you can easily do that within Java (I can give some sample code for that if you like). If you are firing up Firefox because you want that as your user-agent, it's easy to set that programmatically too. Then you don't have to mess with launching/killing Firefox.
 
0
 

Author Comment

by:trip008vk
ID: 33697484
i'm doing this because i need to run some javascript code in firefox, and then have the browser close...
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 3

Expert Comment

by:alanpetersen
ID: 33697615
Have you looked into the javax.script.ScriptEngine functionality? I don't know if this will necessarily solve your problem, but it might be worth considering.

http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
0
 
LVL 26

Accepted Solution

by:
ksivananth earned 2000 total points
ID: 33698735
look at JDIC, you can achieve this using the status update event...
0
 

Author Comment

by:trip008vk
ID: 33718555
ksivananth, could you be a little more clear as to how to use JDIC to solve my issue?

thanks!
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 33722672
look at the downloadCompleted event fired when the page loading completed...
if you particular about the particular javascript function executed, you may want to change the status message from the javascript function which you can listen through JDIC. once you notified the status change event with that particular string you printed through javascript function, you can close JDIC!
0
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 2000 total points
ID: 33722700
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 33722703
0
 

Author Closing Comment

by:trip008vk
ID: 33763148
thanks
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question