Getting runtime error while using Tk.restart

Hi All,

I am using the below given code in ruby but getting a runtime error.

require ‘test/unit’
require ‘watir’
require ‘tk’
require ‘date’
include Watir

class Home_Page < Test::Unit::TestCase
def test_Page
Tk.restart
end
end

Below given the error that i am getting :

Running tests:

E

Finished tests in 0.218750s, 4.5714 tests/s, 0.0000 assertions/s.

  1. Error:
    test_Page(Home_Page):
    RuntimeError:
    Test1.rb:13:in `test_Page’

1 tests, 0 assertions, 0 failures, 1 errors, 0 skips

Exit code: 1

Please help,

Thanks and Regards,
Aakash

Any updates on this?

On Jun 7, 2012, at 6:27 AM, Aakash D. [email protected] wrote:

Any updates on this?


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

The first thing I notice is that test_page is defined without arguments,
but you then hand one in.

Hi Jam,

Thanks for your reply.Is it necessary to pass a an argument.If i comment
the Tk.restart and just right a puts statement it works fine without
error.

Iam not able to find the reason of the error.

Please help,
Aakash

Hi All,

Any update on this ?

Thanks and Regards,
Aakash

From: Aakash D. [email protected]
Subject: Re: Getting runtime error while using Tk.restart
Date: Fri, 8 Jun 2012 15:55:17 +0900
Message-ID: [email protected]

Any update on this ?

I’m sorry, but Tk.restart may not be stable.
I recommend you to use “Tk.root.withdraw” to hide the window,
or “Tk.root.winfo_children.each{|w| w.destroy}” to clean up widgets.