Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 以编程方式按下Sencha触摸按钮的Greasemonkey脚本_Javascript_Extjs_Sencha Touch_Greasemonkey - Fatal编程技术网

Javascript 以编程方式按下Sencha触摸按钮的Greasemonkey脚本

Javascript 以编程方式按下Sencha触摸按钮的Greasemonkey脚本,javascript,extjs,sencha-touch,greasemonkey,Javascript,Extjs,Sencha Touch,Greasemonkey,我正在写一个Greasemonkey脚本,它可以自动完成网站上的任务。我需要填写一张表格,然后按下一个按钮,因为我是用手做的。到目前为止,无论我做什么尝试,我都无法按下按钮。 这是按钮代码: <a class="x-button-normal x-button x-iconalign-left x-layout-box-item Recruit x-last x- button-pressed" id="ext-button-8" style="-webkit-box-flex:

我正在写一个Greasemonkey脚本,它可以自动完成网站上的任务。我需要填写一张表格,然后按下一个按钮,因为我是用手做的。到目前为止,无论我做什么尝试,我都无法按下按钮。 这是按钮代码:

<a class="x-button-normal x-button x-iconalign-left x-layout-box-item Recruit x-last x-      button-pressed" id="ext-button-8" style="-webkit-box-flex: 1;">
<span class="x-badge" style="display: none;"></span>
<span class="x-button-icon" style="background-image: url(https://d38957szc5yx03.cloudfront.net/s/r/mH8qUaabmHUogiiMhHvU1A.png);" id="ext-element-53"></span>
<span class="x-button-label" id="ext-element-52">Recruit</span>
</a>

在这一点上,要么我完全错过了什么,要么我需要触发一个不同的事件来激活按钮。

最后,整个问题是按钮不会对“点击”事件做出反应,而是对“点击”事件做出反应。以下代码起作用:

Ext.get('ext-button-8').fireEvent('tap');

这可能也可以用普通Javascript完成,但触发触摸事件的方式要复杂一些。

只是复制粘贴中的一个输入错误,我这样做是正确的,我会在帖子中编辑错误。您是否尝试过var btn=Ext.Viewport.down('.button[id=Ext-button-8]');btn.fireEvent('tap',btn);
Ext.get('ext-button-8').fireEvent('tap');