Your problem is that unlike the Watir::IE objects, the objects returned
by Watir::IE::Frame are short lived. You are using your reference for
too long. Specifically a page refresh invalidates the object. Details below.
Bret
# return a current, valid reference to the frame.
def content_frame
@ie.frame("ifr_content")
end
# Don't change the @ie object to be the frame!
def setup
@ie = getIEinstance
set_environment(@ie)
login(@ie, "radmin", "radmin747") # Calls the Login Method which
intoduces the wrapper that is
end
# Use the new content_frame method
def test_RuleTemplateWithRule
content_frame.link(:text,'Update the Information).click
etc...
Ajitesh Srinetra wrote:
> Hi Bret
> This is one sample testcase
>
>
>
> require File.dirname(__FILE__) + '/../../../test_helper'
> require File.dirname(__FILE__) + '/../../../Methods/ProcessRecords'
> require File.dirname (__FILE__) + '/../../../Methods/RuleCreation'
>
> class RuleTemplateWithRule_test < Test::Unit::TestCase
>
> def setup
> @ie = getIEinstance
> set_environment(@ie)
> @ie=login(@ie, "radmin", "radmin747") # Calls the Login Method
> which intoduces the wrapper that is
> end
>
> def teardown
> closeIE(@ie)
> end
>
> def test_RuleTemplateWithRule
>
> @ie.link(:text,'Update the Information).click
>
> #Here the Refresh is happening
>
> assert(@ie.contains_text('Another Rule is added'))
>
> # The TestCase starts failing from here as it is not able to find
> the next link as the object ie= ie.frame("ifr_content") is lost
>
> @ie.link(:text, 'View Templates').click
> assert_equal("enable", (@ie.image(:name,
> 'show_CumulativeUsageForIMSI').id))
> assert_equal("disable", (@ ie.image(:name,
> 'editCumulativeUsageForIMSI').id))
> assert_equal("disable", (@ie.image(:name,
> 'deleteCumulativeUsageForIMSI').id))
> end
> end
>
>
> The Login method used earlier in the testcase is writeen below
> def login(ie,username,password)
> ie.text_field(:name, "ranger_user[name]").set(username)
> ie.text_field(:name, "ranger_user[password]").set(password)
> ie.button(:name, "commit").click
> sleep 2
> return ie.frame("ifr_content") #returns the iframe object
> end
>
> I am also using @ie.refresh in some testcases.So I think the method
> also needs to be modified .
>
> Thanks and Regards
> Ajitesh
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general