# Inexplicable failure

**URL:** <https://www.ruby-forum.com/t/inexplicable-failure/144431>\
**Category:** Ruby\
**Created:** [July 29, 2008, 5:27pm UTC](https://www.ruby-forum.com/t/inexplicable-failure/144431 "2008-07-29T17:27:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [July 29, 2008, 5:27pm UTC](https://www.ruby-forum.com/t/inexplicable-failure/144431/1 "2008-07-29T17:27:57Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [July 29, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/inexplicable-failure/144431/2 "2008-07-29T17:46:35Z")

</div>

Bill Bob wrote:

> ```
> errorCount++
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [July 29, 2008, 5:49pm UTC](https://www.ruby-forum.com/t/inexplicable-failure/144431/3 "2008-07-29T17:49:33Z")

</div>

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.
