2014-01-13 133 views
0

當腳本要增加進度值它給了我:比較失敗(引發ArgumentError)

C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-progressbar-1.4.0/lib/ruby-progressbar/components 
/progressable.rb:93:in `<=': comparison of Fixnum with Array failed (ArgumentError) 

腳本顯示belove。我試圖找到解決方案,但沒有運氣。誰能幫我這個?

korpusu_id = [] 
     container.divs(:class => "resItem") 
     .find_all { |div| div.span(:class => "theText", :text => /TestAuto/).exists? } 
    .each do |korpuss| 
     id = korpuss.span.parent.parent.attribute_value("id") 
     id = id[-38..-1] 
     korpusu_id.push(id) 
    end 


    puts "" 
    puts "Tagad notiek nepieciešamo korpusu dzēšana..." 
    progress = ProgressBar.create(:title => "Failu dzēšana:", :progress_mark => "|", :format => "%t [%B] %p%%", :total => korpusu_id) 
    korpusu_id.each do |korp_id| 
     @b.goto("#{@env}/CorpusMetadataEditor.aspx?id=#{korp_id}") 
     @b.execute_script("window.confirm = function() {return true}") 
     delete_poga = @b.link(:id, "ctl00_ContentPlaceHolder1_lnkDeleteCorpora") 
     if delete_poga.exists? 
      delete_poga.click 
     else 
      puts "Korpuss\n#{@env}/CorpusMetadataEditor.aspx?id=#{korp_id}\nlietotājam #{lietotajs} nav pieejams rediģēšanai.\nTurpinu ar nākošo korpusu!\n---------------------------------------------" 
      next 
     end 
     container.div(:class => "resItem").wait_until_present 
     progress.increment 
    end 

回答

0

我發現了我的問題的最終解決方案。我改變了:

progress = ProgressBar.create(:title => "Failu dzēšana:", :progress_mark => "|", :format => "%t [%B] %p%%", :total => korpusu_id.length) 

這對我有用。

對不起,發送垃圾郵件...