6

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:

document.getElementById(":87.mi").children[0].children[0].children[5].children[1].children[0].children[0].children[0].children[1];

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!

4

1 回答 1

-1

我建议下一个解决方案。

在必须从视图导入的 javascript 文件中,放置以下代码:

$(".goog-button-base-content").click(function(){
  //CODE HERE
});

您在这里所做的是,每次我们按下具有该类的 div 时,您都会在“CODE HERE”中启动逻辑

(对不起,我的英语不好)

我希望有用。再见

于 2013-08-12T20:50:22.417 回答