aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Javascript to click a button on a web page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript to click a button on a web page" Watch "Javascript to click a button on a web page" New topic
Author

Javascript to click a button on a web page

Elinor Chang
Ranch Hand

Joined: Jul 30, 2003
Posts: 58
I have a test effort on hand to test the performance of a process triggered by a button-clicking all the way from a webpage and I will have to time the process from the web page down.

I'd like to programatically click (literally) the button on the web page to execute the process. Can I do it using JavaScript?

Any suggestion is very welcomed!
Elinor


The more I learn, the less I know....<br /> <br />SCJP2 <br />SCWCD
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
IE supports button clicking but the other browsers do not support it

document.FormName.ButtonName.clck();

if it is a form submitting, then you can use

document.FormName.submit();

Eric
Elinor Chang
Ranch Hand

Joined: Jul 30, 2003
Posts: 58
Acutually, I am looking for a script to click a button on another web page. A JavaScript can only access HTML objects of the same page as far as I know...

Any other ideas?
Elinor
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
JavaScript can only access the elements on the same page or on other pages in the same domain. If it is some other site, then there is nothing you can do wih JavaScript do to security restrictions.

Eric
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
What Eric said,
unless you writing some kind of html, which is going to be on your local computer(not on web server). Than you can use HTA file with IE - security limitation will not apply to it.
Look at msdn for HTML Application.
If you need an example, look at my web site for "Web page test automation toolkit ".
[ November 29, 2004: Message edited by: Yuriy Fuksenko ]
Elinor Chang
Ranch Hand

Joined: Jul 30, 2003
Posts: 58
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript to click a button on a web page
 
Similar Threads
changing the appearance of the current page with javascript
Reloading a parent window 1 after submit from window 2
Make an alt-tab fonction in javascript
Open JSP page deployed in other web server
How to Export web page(jsp page) to excel using jsp or servlets