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

Javascript to click a button on a web page

 
Elinor Chang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic