在下面的代码中,我想处理异常。msg[0]
如果没有找到,我必须msg[2]
在救援中捕获该异常消息,如果找到,则放置成功消息msg[1]
puts "Verifying Home Page"
def verifyHomepage(*args)
begin
args.each do |msg|
page.find(msg[0])
puts msg[1]
rescue
puts msg[2]
end
end
end
verifyHomepage(['#logoAnchorr', 'logo anchor found', 'Logo anchor not Found'], ['.navbar-inner', 'Header Bar found', 'Header Bar not Found'])
在上面的代码中,我得到
error sysntax error unexpected keyword rescue expecting keyword end