[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Inexplicable failure

Bill Bob

7/29/2008 3:27:00 PM

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/?pa...)
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-...attachment/245...

--
Posted via http://www.ruby-....

2 Answers

Peter Hickman

7/29/2008 3:45:00 PM

0

Bill Bob wrote:
> errorCount++
>

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


Bill Bob

7/29/2008 3:49:00 PM

0

Peter Hickman 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.

--
Posted via http://www.ruby-....