我试图将我的旧watir脚本转换为使用watir-webdriver,因为这将(最终)支持IE9和Firefox 4. $browser.table_row(:id => "account_1").click
是我用来单击watir/firewatir屏幕上第一行的表格,但是这个API在watir-webdriver中被修改。现在,代码是这样的:$browser.table(:class => "sortable")[0].click
应该抓住表格的第一行然后点击它。它似乎是成功的,因为它继续执行代码,但实际上并未单击该行。使用watir-webdriver,我怎样才能点击一个表格行?
有人可以解释什么是正确的语法在这种情况下?
这里的周围区域的源代码,我想点击:
<table class="sortable">
<thead>
<tr id="">
<th> </th>
<th class="sort" > Name </th>
<th class="sort" > Number </th>
</tr>
</thead>
<tbody>
<tr id="account_1" onclick=";$('timer').show();; new Ajax.Request('create_new_account', {asynchronous:false, evalScripts:true, onComplete:function(request){;$('timer').hide();initializeCustomEffects();}})">
<td></td>
<td class="sortTd">Test Account</td>
<td class="sortTd">1</td>
</tr>
</tbody>
页面HTML的样本可能有助于查看事件对事件做出的反应,如何识别其中的行或元素等。 – 2011-04-19 20:06:04