Inexplicable failure

B

Bill Bob

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.

Attachments:
http://www.ruby-forum.com/attachment/2459/cheat.rb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,099
Latest member
AmbrosePri
Top