Aug
21
2008
0

How do I get the URL in IE?

A. Use the autoit function library with the win32OLE extension library…
You will need to install autoit. You can download it here, once installed you can call the function library using the win32OLE extension library.

require 'watir'
require 'rubygems'
require 'win32ole'
autoit = WIN32OLE.new('AutoItX3.Control') 
url = autoit.ControlGetText("[CLASS:IEFrame]", "", "Edit1")
puts "url is " + url

The defintion for the autoit function ‘ControlGetText’ is ControlGetText(title, text, controlId)
You can use the “AutoIt Window Info” tool to find the title and controlId, you do not need to use the ‘text’ parameter. I find that using the Class instead of the window title a neater and more accurate solution.

Written by Sameh Abdelhamid in: watir | Tags: , ,

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes