Simulate click on DIV

I am developing a desktop application in Delphi XE4 using TChromium component to display Google Voice webpage.

I need to start a call programmatically and I can't find a way to trigger the javascript code behind the button (it is a DIV) "CONNECT":

enter image description here

TChromium allows to execute javascript code and I already managed to simulate the click on "CALL" button using a javascript code that simulates the Key Event using the character "c" which display the panel. This works because Google Voice has shortcuts and "c" is a valid shortcut to start a call. Also with javascript I can set the number in the input field. My main problem is that I don't know how to simulate a click on "CONNECT":

enter image description here

As you can see, there is no ID, no onClick and there is no shortcut to trigger the Connect button.

I can get a reference to this DIV using the following code:


But it is not possible to trigger anything appending .click(). I assume it is because click() will trigger onClick method that it is not defined. Is there any way to know what javascript code executes when someone clicks over this div?

If the focus is in the "Number to call" input, I can press "TAB" to navigate to "Phone to call with", then to "Remember to choice" and finally to "Connect" where I can press Enter key to make it work also. I tried to use the same code as in the beginning to simulate the CALL button but this time with TAB (keycode 9 instead of 67) and it does not work as the focus does not move.

I tried to do it programmatically with delphi also using mouse_event, keybd_event, PostKeyExHWND, PostKeyEx32 and PostMessage with no results as the focus does not move away from "Number to call"

The only option that works by now is to move the mouse with delphi using SetCursorPos and simulate a click on that button calculating the coordinates but this will be my last option to choose as I would prefer a javascript code to do it.

Any suggestions are welcome!



I suggest the next solution.

In a javascript file that have to be imported from the view, put the next code:


What you do here is that everytime that we pressed the div that has that class, you will start the logic inside "CODE HERE"

(Sorry for my bad english)

I hope be usefully. See you


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.