How do I simulate a button click in a browser?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

How do I simulate a button click in a browser?

Post by paulclaude »

Hi,

I would like to simulate a mouseclick on a button that appear in a revBrowser windoid. There's a way to do it?

Thanks
shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: How do I simulate a button click in a browser?

Post by shaosean »

You might be able to do it through JavaScript and the revBrowserExecuteScript function
paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: How do I simulate a button click in a browser?

Post by paulclaude »

Thank you, shaosean, I think I could use something like this: "document.getElementById('youridhere').click()".

The problem is that I must click simple href links, without ID (es: <a href="www.google.com">Google</a>).

Any suggestion?
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I simulate a button click in a browser?

Post by Klaus »

Hi Paul,

can't you just:
...
revbrowserset tBrowserID, "url","www.google.com"
...
instead of really clicking?
Result should be the same :D


Best

Klaus
paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: How do I simulate a button click in a browser?

Post by paulclaude »

Hi Klaus, this is exactly what I'm doing now. I will continue in this way...

Greetings

Paul
seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: How do I simulate a button click in a browser?

Post by seaniepie »

This is an old thread but I just found this and know it will be useful in the future:

https://developer.mozilla.org/en-US/doc ... ing_events

Particularly the bit headed Triggering built-in events. I got it working from this directly.

All the best
Pi
lilRalph
Posts: 25
Joined: Wed Aug 26, 2015 9:43 am

Re: How do I simulate a button click in a browser?

Post by lilRalph »

Interesting that this is such an old thread and yet it still gets a lot of views.

The answer from Pi does work but there is an easier way.
In the demo in the second message here http://forums.livecode.com/viewtopic.php?f=11&t=25307 you will find a working method which works reliably and I find easy to use.

My apologies for hijacking an old thread and then pointing you to my own post but my title doesn't look like it would have an answer for this question.
Post Reply