嗨,我正在自动化使用智能 gwt 控件构建的网页。我使用定位器记录了单击列表网格中的复选框。我尝试单击 Xpath ,它返回响应正常但不会单击。
scLocator=//ListGrid[ID=\"isc_SideListGrid_0"\"]/body/row[1]/col[isCheckboxField=true||0]
Xpath:
selenium.click("//div//table[@id='isc_17table']//tbody/tr[1]/td[1]/div/nobr/img");
一行的 HtML 源代码
<div id="isc_17" style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200450;CURSOR:default;" eventproxy="isc_SideListGrid_0_body">
<div style="position:relative;z-index:1000;">
<div id="isc_SideListGrid_0_body$28s" style="width:1px;height:0px;overflow:hidden;display:none;">
<table id="isc_17table" class="listTable" width="654" cellspacing="0" cellpadding="2" border="0" style="table-layout:fixed;overflow:hidden;wrap:false;padding-left:0px;padding-right:0px;" role="presentation">
<tbody></tbody>
<colgroup>
<tbody>
<tr role="listitem">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 28px; overflow: hidden;">
<div style="overflow: hidden; width: 24px;" cellclipdiv="true" role="presentation">
<nobr>
<img width="13" height="13" border="0" align="TEXTTOP" suppress="TRUE" style="vertical-align:middle;margin-left:2px;margin-right:2px;" eventpart="valueicon" src="http://localhost:8080/oatedge/reports/acceptanceReport/sc/skins/Enterprise/images/DynamicForm/checked.png">
</nobr>
</div>
</td>
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 80px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
</tr>
</tbody>
</table>
<div id="isc_SideListGrid_0_body$284" style="width:1px;height:0px;overflow:hidden;display:none;">
</div>
<div onscroll="return isc_HLayout_5.$lh()" style="position: absolute; left: 558px; top: 3px; width: 100px; height: 22px; z-index: 200900; visibility: inherit; padding: 0px; -moz-box-sizing: border-box; overflow: hidden; cursor: default;" class="normal" eventproxy="isc_HLayout_5" id="isc_30">
<div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200900;CURSOR:default;" eventproxy="isc_HLayout_5" id="isc_31"> <div onscroll="return isc_ImgButton_4.$lh()" style="position: absolute; left: 18px; top: 1px; width: 20px; height: 19px; z-index: 200918; -moz-box-sizing: border-box; overflow: hidden;" tabindex="1764" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_4,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_4,true);" class="imgButton" role="button" eventproxy="isc_ImgButton_4" id="isc_33"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200918;CURSOR:pointer;" eventproxy="isc_ImgButton_4" id="isc_32"><img width="20" height="19" border="0" align="TEXTTOP" suppress="TRUE" name="isc_32main" src="http://localhost:8080/oatedge/reports/images/icon-delete-d.png"></div></div><div onscroll="return isc_ImgButton_3.$lh()" style="position: absolute; left: 41px; top: 1px; width: 20px; height: 19px; z-index: 200936; -moz-box-sizing: border-box; overflow: hidden;" tabindex="1815" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_3,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_3,true);" class="imgButton" role="button" eventproxy="isc_ImgButton_3" id="isc_35"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200936;CURSOR:pointer;" eventproxy="isc_ImgButton_3" id="isc_34"><img width="20" height="19" border="0" align="TEXTTOP" suppress="TRUE" name="isc_34main" src="http://localhost:8080/oatedge/reports/images/icon-accept-d.png"></div></div><div onscroll="return isc_ImgButton_5.$lh()" style="position: absolute; left: 64px; top: 0px; width: 18px; height: 15px; z-index: 200954; -moz-box-sizing: border-box; overflow: hidden;" tabindex="1866" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_5,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_5,true);" class="imgButton" role="button" eventproxy="isc_ImgButton_5" id="isc_37"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200954;CURSOR:pointer;" eventproxy="isc_ImgButton_5" id="isc_36"><img width="18" height="15" border="0" align="TEXTTOP" suppress="TRUE" name="isc_36main" src="http://localhost:8080/oatedge/reports/images/icon-merge-d.png"></div></div></div></div>