I'm running a script, which has a rescue clause, but I want it to
(essentially) break, when the rescue clause is invoked.
Instead, it runs to the next line:
C:\Documents and Settings\Marissa\Desktop>ruby T3.rb
What is the user's First Name?
Test
What is the user's Last Name?
Test
ALERT: You must have a running instance of SVC open!
Please log into SVC and restart Sevin. Exiting: Code1.
T3.rb:18: undefined method `frame' for nil:NilClass (NoMethodError)
To state the obvious: The frame it's looking for is not going to be
there, so I don't even want it to go there.
[Code]
require 'watir'
puts "What is the user's First Name?"
Fname = gets.chomp #Removes return (recognized as new line command)
character '\n'
puts "What is the user's Last Name?"
Lname = gets.chomp #Removes return (recognized as new line command)
character '\n'
begin
@browser = Watir::IE.attach(:url, 'https://
www.servicecenterweb.unisys.com/sc2/index.do')
rescue Watir::Exception::NoMatchingWindowFoundException
puts "ALERT: You must have a running instance of SVC open!"
@browser1 = Watir::IE.new
@browser1.goto('https://www.servicecenterweb.unisys.com/sc2/
index.do')
puts "Please log into SVC and restart Sevin. Exiting: Code1."
end
@browser.frame(:id, 'detail').button(:id, 'X8').click
#Insert company name and user
@browser.frame(:id, 'detail').text_field(:id, 'X7').set("BAXTER")
@browser.frame(:id, 'detail').text_field(:id, 'X78').set(Fname)
@browser.frame(:id, 'detail').text_field(:id, 'X80').set(Lname)
[/Code]
If I put a 'break' in the rescue clause, it doesn't seem to like it,
and 'end' really doesn't "end", as you can see.
So, is there a way I can ditch the script, if the rescue is invoked,
or will I just have to deal with it going on to the next line?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---