简体   繁体   English

点击事件未在GWT网站上触发

[英]Click event not firing on GWT site

I am attempting to automate testing on the client side of a GWT built site. 我正在尝试在GWT构建站点的客户端上进行自动化测试。 I have been able to run through all the DOM elements and find the span element which is clickable I tried the click() method but it never fires. 我已经能够遍历所有DOM元素并找到了可点击的span元素,我尝试了click()方法,但从未触发。

This can only be done on the client-side. 这只能在客户端完成。 I cannot adjust the source code to contain any ID's or names. 我无法调整源代码以包含任何ID或名称。

Here is my HTML code from the scratch pad. 这是我从头开始的HTML代码。 This does find the div that contains the table and get the span tag which is inside the first td. 这确实找到了包含表的div,并获得了第一个td内的span标签。

    <div tabindex="1779" id="isc_8C" style="left: 0px; top: 62px; width: 1566px; height: 165px; overflow: hidden; display: inline-block; position: absolute; z-index: 201998; cursor: default; background-color: white;" onfocus="isc.EH.focusInCanvas(ResultsGrid_1_body,true);"
onblur="if(window.isc)isc.EH.blurFocusCanvas(ResultsGrid_1_body,true);" onscroll="return ResultsGrid_1_body.$lh()" eventproxy="ResultsGrid_1_body">
    <div id="isc_8B" style="width: 1566px; position: relative; z-index: 1000;">
        <form onsubmit="return false;" action="javascript:void(0)">
            <div id="ResultsGrid_1_body$28s" style="width: 1px; height: 0px; overflow: hidden; display: none;"><span style='width: 1px; height: 0px; vertical-align: text-top; display: inline-block;'></span>
            </div>
            <table width="1550" class="listTable" id="isc_8Ctable" role="presentation" style="overflow: hidden; table-layout: fixed;" border="0" cellspacing="0" cellpadding="2">
                <tbody>
                    <tr role="listitem" aria-selected="true" aria-posinset="1" aria-setsize="1">
                        <td width="396" align="left" class="tallCellSelectedOver" style="height: 16px; overflow: hidden;">
                            <span class="clickable">748754434564</span>
                        </td>
                        <td width="180" align="left" class="tallCellSelectedOver" style="height: 16px; overflow: hidden;">Jon, smith</td>
                </tbody>
            </table>
            <div id="ResultsGrid_1_body$284" style="width: 1px; height: 0px; overflow: hidden; display: none;"><span style='width: 1px; height: 0px; vertical-align: text-top; display: inline-block;'></span>
            </div>
        </form>
    </div>
</div>

And the script code is 脚本代码是

$('div [eventproxy=ResultsGrid_1_body] table td span').click();

How can I perform a click on the span tag? 如何点击span标签?

try to associate id with the span , then add the function just before the end of body tag or if including a js file, then call it just above the body tag, not at the starting. 尝试将id与span关联,然后在body标签末尾之前添加功能,或者如果包含js文件,则在body标签上方而不是在开头处调用该函数。

<span id="sp"> </span>

working example can be seen here 工作示例可以在这里看到

https://jsfiddle.net/2b645Lup/5/ https://jsfiddle.net/2b645Lup/5/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM