Hello Everyone,
I have been trying to handle File Download pops in FF browser. I had
posted a similar question in the FireWatir group (http://
groups.google.com/group/firewatir/browse_thread/thread/
645846692f7d64fd?ie=utf-8&oe=utf-8&q=watir+-+file+download+in
+Firefox#903516a40a227883), But I thought it would be better here, as
I am actually using Watir.
My script works successfully until the popup is shown, but does
nothing after that. The code is very similar to the one that I use for
IE.
------------------
require 'watir'
require 'win32ole'
Watir::Browser.default='firefox'
$browser=Watir::Browser.new
def save_file(filename)
filepath = "c:\\#{File.basename(filename, '.rb')}"
sleep(10)
ai = WIN32OLE.new("AutoItX3.Control")
window_title = ai.WinGetTitle("[active]") # This is to get the
title of the popup. Since this changes in FF, for every file download.
sleep 1
ai.ControlFocus(window_title, "", "&OK")
sleep 1
ai.ControlClick(window_title, "", "&OK")
sleep 1
ai.ControlSend("Enter name of file to save to...", "",
"Edit",filepath)
sleep 1
ai.ControlClick("Enter name of file to save to...", "", "&Save")
window_title1 = "Enter name of file to save to..."
ai.ControlFocus(window_title1, "", "&Yes")
sleep 1
ai.ControlClick(window_title1, "", "&Yes")
end
$browser.goto("
http://abcd.com")
sleep 2
$browser.link(:text, "zzz.zip").click
sleep 5
save_file("zzz")
--------------------------
The popup remains and nothing happens. The scripts finishes running
without any errors.
But the same code works great with IE. Can someone help in pointing
the problem here?
Also how to control Radio buttons using AutoIt (for the same file
download popup).
Thank you very much.
Margam