我試圖將我的舊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