瓦蒂尔+;gwt应用程序
我正在为GWT应用程序编写自动测试。我试着双击table元素。我正在使用此代码单击:瓦蒂尔+;gwt应用程序,gwt,click,double,watir,Gwt,Click,Double,Watir,我正在为GWT应用程序编写自动测试。我试着双击table元素。我正在使用此代码单击: browser.element(:xpath, '/html/body/div[5]/div[2]/div/div/div/div[2]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/table/tbody[2]/tr[1]/td[1]/div').double_click 执行此命令时,会出现如下错误: Cannot perform na
browser.element(:xpath, '/html/body/div[5]/div[2]/div/div/div/div[2]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/table/tbody[2]/tr[1]/td[1]/div').double_click
执行此命令时,会出现如下错误:
Cannot perform native interaction: Could not load native events component
我已将此代码添加到脚本中,但这没有帮助:\
profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = true
browser = Watir::Browser.new :firefox, :profile => profile
这是html的一部分,我尝试单击:
<tbody>
<tr aria-posinset="0" aria-setsize="11" role="listitem">
<td class="cellSelected" height="22" align="left" style="padding-top: 0px; padding-bottom: 0px; width: 100px; overflow: hidden;">
<div style="overflow:hidden;WIDTH:96px;" cellclipdiv="true" role="presentation">
<nobr>2004</nobr>
</div>
</td>
<td class="cellSelected" height="22" align="left" style="padding-top: 0px; padding-bottom: 0px; width: 371px; overflow: hidden;">
<div style="overflow:hidden;WIDTH:367px;" cellclipdiv="true" role="presentation">
</td>
<td class="cellSelected" height="22" align="right" style="padding-top: 0px; padding-bottom: 0px; width: 200px; overflow: hidden;">
<td class="cellSelected" height="22" align="left" style="padding-top: 0px; padding-bottom: 0px; width: 372px; overflow: hidden;">
</tr>
<tr aria-posinset="1" aria-setsize="11" role="listitem">
<tr aria-posinset="2" aria-setsize="11" role="listitem">
<tr aria-posinset="3" aria-setsize="11" role="listitem">
<tr aria-posinset="4" aria-setsize="11" role="listitem">
<tr aria-posinset="5" aria-setsize="11" role="listitem">
<tr aria-posinset="6" aria-setsize="11" role="listitem">
<tr aria-posinset="7" aria-setsize="11" role="listitem">
<tr aria-posinset="8" aria-setsize="11" role="listitem">
<tr aria-posinset="9" aria-setsize="11" role="listitem">
<tr aria-posinset="10" aria-setsize="11" role="listitem">
</tbody>
2004
我知道xpath不是preety,但它可以工作。例如,常规单击正常工作
我使用selenium 2.31、ruby 1.9.3和firefox 17
这是桌子和桌子。谢谢
<div id="isc_K7" style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:206084;CURSOR:default;" eventproxy="isc_PolicyListGrid_1_body">
<div style="position:relative;z-index:1000;">
<div id="isc_PolicyListGrid_1_body$47a" style="width:1px;height:0px;overflow:hidden;display:none;">
<img width="1" height="0" border="0" align="TEXTTOP" suppress="TRUE" src="blank.gif">
</div>
<table id="isc_K7table" class="listTable" width="1043" 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>
</table>
<div id="isc_PolicyListGrid_1_body$47t" style="width:1px;height:0px;overflow:hidden;display:none;">
</div>
<table style="position:absolute;top:0px;font-size:1px;height:100%;width:100%;z-index:1;overflow:hidden;visibility:hidden;">
</div>
这与您之前的问题不同吗?是的,在previus问题中,Chuck van der Linden写道:“开始一个新问题,包括该div所在表的一些HTML”,所以我这样做了。这是指如何在不使用xpath的情况下最佳选择元素,以一种不会因为开发者对页面的细微更改而变得脆弱和断裂的方式。。我们可以编辑此问题以反映这一点,并回答您问题的这一方面。您提供的HTML中几乎没有方便的标识符,您能否包括表的标记以及保存它的div?