我們的 Thomas Walpole 在下面的這個邏輯中幫助了我很多。我有一個問題,當記錄在第一頁時,移動到串列中下一頁的按鈕被禁用。如果記錄在第一頁上,我該怎么做,它沒有進入掃描螢屏以查找此記錄的回圈?
def cad_diametro_material_ativo
input_codigo.send_keys('aut_Server_AL')
input_ordem.send_keys('1')
@gera_material_ativo = 'AUT_Server_ALUMINIO_ATIVO' rand(1..99).to_s
input_descricao.send_keys(@gera_material_ativo)
btn_inserir.click
until page.has_css?("td", text: @gera_material_ativo, wait: 3) do
btn_move_registros.click
end
find("td", text: @gera_material_ativo).click
btn_cancelar.click
end
hml code
<div id="AFRAME_14bb" onm ousedown="event.preventMoving=true;" style="display: inline-block; box-sizing: border-box; min-width: 100%;" class="tv">
<a name="tvTDiametroMat"></a>
<div >
<div style="display:inline-block;width:100%"><img src="r/std/static/pixel.gif" hljs-string">" draggable="false" onclick="sendEvent(0,event,this,true,0,'','14bb','ControlMenu#','','','','','');"> Diametro do Material</div>
</div>
<div id="TV-tvTDiametroMat">
<div style="" hljs-string">">
<div style="display:table;width:100%; background:inherit;">
<div style="display:table-cell;vertical-align:top; background:inherit;" hljs-string">">
<div hljs-string">">
<div>1</div>
<div><img src="r/std/static/pixel.gif" hljs-string">" draggable="false"></div>
<div><img src="r/std/static/pixel.gif" hljs-string">" draggable="false"></div>
<div><img src="r/std/static/pixel.gif" hljs-string">" draggable="false" onclick="loadPage('tvTDiametroMat','1','11',2);"></div>
<div><img src="r/std/static/pixel.gif" hljs-string">" draggable="false" onclick="loadPage('tvTDiametroMat','10','11',2);"></div>
</div>

uj5u.com熱心網友回復:
until page.has_css?("td", text: @gera_material_ativo, wait: 3) do
btn_move_registros.click
end
td如果第一頁在指定的等待期內沒有所需的元素,則只會單擊按鈕轉到下一頁。如果即使您認為預期td在第一頁上,它仍單擊進入下一頁,那么很可能您的wait設定不夠長,無法呈現第一頁。嘗試增加wait值
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/490317.html
