Inexplicable failure

I’m getting an inexplicable error when I try to run this script. Here’s
the script, and the error message I get.

require ‘watir’
require ‘spec’
require ‘dl’

b = Watir::IE.start(‘http://www.tv.com/tv-awards/?page=27’)
b.set_fast_speed

def doIt(b)
i = 0
errorCount = 0
voteCount = 0
while 0 == 0
begin
voteCount = b.div(:class => ‘person_pod’, :index => 1).div(:class,
‘vote_results’).div(:class, ‘vote-totals’).text
b.div(:class => ‘person_pod’, :index => 1).div(:class,
‘vote_again’).link(:index, 1).click
b.div(:index, 1).click
i += 1
if voteCount == b.div(:class => ‘person_pod’, :index =>
1).div(:class, ‘vote_results’).div(:class, ‘vote-totals’).text
if errorCount >= 5
errorCount = 0
b.refresh()
puts 'reset browser here: ’ + i.to_s()
else
errorCount++
end
else
errorCount = 0
end
rescue
puts 'failed here: ’ + i.to_s()
b.div(:index, 1).flash
end
end
end

describe ‘cheat’ do
it ‘perform’ do
puts ‘Beginning run’
doIt(b)
puts ‘Ending run’
end
end


ruby cheat.rb
cheat.rb:25: syntax error, unexpected kEND
cheat.rb:29: syntax error, unexpected kRESCUE, expecting kEND
cheat.rb:42: syntax error, unexpected $end, expecting kEND
Exit code: 1

Line 25 is the END after errorCount++.

Any assistance would be greatly appreciated.

Bill Bob wrote:

      errorCount++

Here you go, this is a Cism you need to write errorCount += 1 in ruby

Peter H. wrote:

Bill Bob wrote:

      errorCount++

Here you go, this is a Cism you need to write errorCount += 1 in ruby

Thank you soooo much, it works now, this was really bugging me.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs