Can URI retrieve the URL of a webpage when its open?

Can I use uri to get the URL Of a web page?
I am opening a webapge by clicking on a link and I am flipping to this
new window after I have gotten the handle, I attach to the window after
attaching to this window, I want to use rio to save the webpage to a
file since I need to check it. I can not depend on having a static URL
since the system under test generates URLs dynamically

1 $ms=Watir::IE.attach(:title, htmlemailname)
2 rio($ms)>rio(“C://TestResult//index.html”)

Line 2 fails cause I think that rio wants

rio(“www.webpage.com”)>rio(“C://TestResult//index.html”)

Is there any way to get the URL of a webpage once it is opened?

Is there any way to get the URL of a webpage once it is opened?

require ‘watir’
w = Watir::IE.new
u = ‘http://somesitewithredirection.com
w.goto(u)

puts w.document.URL

__ __ wrote:

Is there any way to get the URL of a webpage once it is opened?

require ‘watir’
w = Watir::IE.new
u = ‘http://somesitewithredirection.com
w.goto(u)

puts w.document.URL

This bit won’t work since I dont know the URL,its dynamic. I am
attaching to the window because I know the title and then I get the
window handle and I interact with the window. but you have given me an
idea cause I can get the URL after I have the handle.

Thanks!!!
Arti