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

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 » Thu May 09, 2013 11:25 am

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

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: 13866
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Thu May 09, 2013 3:19 pm

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 » Thu May 09, 2013 6:16 pm

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

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

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

Return to “Internet”