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 
4

1 回答 1

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
    end
        i = i + 1   
            if i == 8 && browser.button(:name => "OpSelect").click.exists?
                browser.button(:name => "OpSelect").click
                i = 0
            end

end 
于 2012-11-05T15:47:06.007 回答