Page 1 of 1

How do I simulate a button click in a browser?

Posted: Tue May 07, 2013 5:59 pm
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

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

Posted: Thu May 09, 2013 11:25 am
by shaosean
You might be able to do it through JavaScript and the revBrowserExecuteScript function

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

Posted: Thu May 09, 2013 2:53 pm
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?

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

Posted: Thu May 09, 2013 3:19 pm
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

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

Posted: Thu May 09, 2013 6:16 pm
by paulclaude
Hi Klaus, this is exactly what I'm doing now. I will continue in this way...

Greetings

Paul

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

Posted: Fri Jul 10, 2015 12:46 am
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

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

Posted: Fri Dec 18, 2015 11:18 am
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.