0
我想填充文本字段,但我的while循環它不工作它卡住我的循環。你能讓我知道我做錯了什麼嗎?雖然循環不停止
mainStatus = ['vehicleList[0].mainStatus','vehicleList[1].mainStatus','vehicleList[2].mainStatus','vehicleList[3].mainStatus','vehicleList[4].mainStatus','vehicleList[5].mainStatus','vehicleList[6].mainStatus','vehicleList[7].mainStatus']
subStatus = ['vehicleList[0].subStatus','vehicleList[1].subStatus','vehicleList[2].subStatus','vehicleList[3].subStatus','vehicleList[4].subStatus','vehicleList[5].subStatus','vehicleList[6].subStatus','vehicleList[7].subStatus']
i = 0
while browser.text_field(:name => 'selection').value == ''
if browser.span(:name => mainStatus[i]).text == 'AVAILABLE' && (browser.span(:name => subStatus[i]).exists?) == false
browser.text_field(:name => 'selection').set (i + 1).to_s
browser.button(:name => "OpSelect").click
else
i + 1
end
if i == 8 && browser.button(:name => "OpSelect").click.exists?
browser.button(:name => "OpSelect").click
i = 0
end
end
我無法弄清楚你正在嘗試做的。沒有什麼能滿足循環條件的結束。如果選擇text_field爲空白,則在選擇text_field中鍵入內容並單擊opselect按鈕。 text_field是否再次變爲空白?假設你到達i == 8,那麼你點擊opselect按鈕。但是,當重新接近while語句時,選擇text_field的內容會變得多少? –