Leon
The one thing that jumps to mind is that
you are logging on using “FrameMenu” and you are logging off using “FrameMain”.
I’m thinking you should be using the same frame name to be logging on and
off unless you navigate to another frame, which I don’t think you are
doing.
In your log off try:
def logOff
$ie.frame(:name, "FrameMenu").image(:index, 9).click
end
Hope that helps
Tom
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Thursday, September 01, 2005
5:56 PM
To: [email protected]
Subject: [Wtr-general] Need help
with Watir/Ruby.
This email is to be read subject to the
disclaimer below.
Hello
guys,
The
response to my last query was just amazing. I got a few responses the same day.
Thank you very much.
Hopefully
someone will be able to help me with this question too.
I
have to rb files: Watir test driver, which has the Test::Unit::TestCase def and
all the tests; and the other file "Utilities" has a number of
functions which i am trying to call from the first file.
The
Utilities file looks sothing like this:
class Utilities
def initialize(ie)
$ie = ie
end
def logOff
$ie.frame(:name, "FrameMain").image(:index, 9).click
end
def logOn
$ie.text_field(:name, "txtUsername").set($user)
$ie.text_field(:name, "txtPassword").set($pwd)
$ie.button(:name, "btnLogon").click
begin
assert($ie.frame("FrameMenu"))
$log.info("TEST PASSED: Logon successful")
rescue => e
$log.error("TEST FAILED: Logon Failed " +
e.message + "\n" + e.backtrace.join("\n"))
end
end
end
And
the Watir tes file:
# include the watir classes
require 'watir'
include Watir
#test::unit includes
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
# A test class using Test::Unit::TestCase will run
automatically when
# included using require.
class TC_TaxIntegrator < Test::Unit::TestCase
require
"utilities/utils.rb"
$aUtilities =
Utilities.new($ie)
def test_logon
$aUtilities.logOn
end
def test_logOff
$aUtilities.logOff
end
end
When
I run the test, it successfully logs in, but produces the following error on
logOff:
1) Error:
test_logOff(TC_TaxIntegrator):
Watir::Exception::UnknownFrameException: Unable to locate a frame with name
FrameMain
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1739:in `initialize'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:222:in `new'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:222:in `frame'
./utilities/utils.rb:75:in `clickLogOffButton'
TestContainer.rb:44:in `test_logOff'
Any
ideas?
Best
regards
Leon
--------------------
NOTICE - This communication contains information which is confidential and the
copyright of Ernst & Young or a third party.
If you are not the intended recipient of this communication please delete and
destroy all copies and telephone Ernst & Young on 1800 655 717 immediately.
If you are the intended recipient of this communication you should not copy,
disclose or distribute this communication without the authority of Ernst &
Young.
Any views expressed in this Communication are those of the individual sender,
except where the sender specifically states them to be the views of Ernst &
Young.
Except as required at law, Ernst & Young does not represent, warrant and/or
guarantee that the integrity of this communication has been maintained nor that
the communication is free of errors, virus, interception or interference.
Liability limited by a scheme approved under Professional Standards Legislation.
--------------------
If this communication is a
"commercial electronic message" (as defined in the Spam Act 2003) and
you do not wish to receive communications such as this, please forward this
communication to [EMAIL PROTECTED]