• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Interacting with Internet Explorer

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I tried using "exec()" to invoke the Internet Explorer. Now I want to interact with the IE such as opening an html file, click the view source, etc., In short I want to invoke some other menus of the IE. Is it possible with a Java Program. Does Java support such kind of operations. I want to access my local machine only not in a network.

Thanks in Advance!!!
dinesh.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds awkward. Are you just after the source of a particular page, or do you need some functionality specific to IE?
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to invoke the functionalities of IE.
That is using exec() i can simply invoke the Internet Explorer.. Now i want to load a particular page such as test.html which is stored in my local drive..

Thanks in Advance!!!
dinesh.
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could try using something from the KeyEvents class. To send the keys of shortcuts to internet explorer. "CTRL-N" to open a new window.

http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/KeyEvent.html
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you'll need to invoke some native technology to interact with the browser window, since Java has no access to it, beyond running IE. Off the top of my head I can't think of an easily available one. You might try browsing MSDN to find something suitable.
[ January 11, 2007: Message edited by: Paul Sturrock ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did a Google on "win32 sendkey script" and got a lot of hits. We've been looking at some expensive commercial products that do a bang up job of this kind of thing: OpenSpan, Jacada, eGlue. Any GUI test tool should be able to do what you're after ... maybe you can extract some parts of one of those. A simple VB script might take you far enough, too. Let us know what you find!
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't it possible, to use awt.Robot, to move the mouse and send events to other applications?

IE has an option to start with a specific page, like

That's pseudocode. See the fine manual for the real command.
 
Marshal
Posts: 27993
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to know what the actual requirements are here. In other words, why would you want to do that? Your original post suggests you want to get at the source code of an HTML page from the web somewhere, and for that you don't need to remote-control that hulking robot IE. You can access the code directly and easily using classes in the java.net package.
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Thanks. My original requirement is i would like to generate some HTML files through my program after that i have to invoke them that means i have to Load the pages through my program not by requesting the user to double click the HTML file.

dinesh.
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, then see Stefan's post above. You can easily specify the document to open when you launch IE. Don't make this so complicated!
 
Paul Clapham
Marshal
Posts: 27993
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also run the Windows shell command START to load an HTML file in the computer's default browser (which might not be IE):

START \path\to\the.html
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stephan and Paul,

Thanks for your ideas. It works from my command prompt as an external command but when try to run from the Java Program using exec. Its not working.

java.io.IOException: CreateProcess: start C:/test.html error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at Explorer.main(Explorer.java:4)

Getting the following error.
So now trying using the Robot Class.
Will update you about the results.
Thanks,
dinesh.
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it using Robot Class
Thanks and Thanks a Lot!!!
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tell me more about how you used Robot. With IE? Sounds interesting awright.
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Sorry for late response as i was in holiday.

Using the Robot i simulated the keyPress(VK_WINDOWS);
then keyPress(VK_R);

which pops up the run prompt. Then i simulated a series of key press events.

VK_I
VK_E
VK_X
VK_P
VK_L
VK_O
VK_R
VK_E

VK_ENTER

this resulted in invoking the IE. After using the mouseMove(15,15);
i made the mouse to move to the File menu.

then simulated the mousePress() and mouseRelease() causing the mouse click on File menu.. like that i interacted.

regards,
dinesh.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 67735
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic