How to handle firefox download popup

2353 views
Skip to first unread message

Dev..

unread,
Mar 22, 2010, 7:16:00 AM3/22/10
to seleniu...@googlegroups.com, selenium-...@googlegroups.com, selenium-...@googlegroups.com
Hello
    can anyone let me know how can i handle the firefox "Download" popup or any other firefox popup through selenium with java.

Suggestions will be appreciated.


Regards
-Dev

Rajat Jindal

unread,
Mar 23, 2010, 12:17:04 PM3/23/10
to Selenium Users
Hi,

You can issue a selectWindow command to selenium RC server, which
accepts the Window's ID as the input and selects the window but this
is valid if the popup that you are trying to select is a browser
popup. To select the download window which is (probably) a OS window,
you will need something like Autoit.

Never really got a chance to work on Autoit, but heard its really good
for such automation.

Hope it helps.

Thanks,
Rajat Jindal
quicksilver1183-tech.blogspot.com

Martin

unread,
Mar 23, 2010, 12:37:00 PM3/23/10
to Selenium Users
AutoIt will work for clicking thru those pop-up dialogs.

If you are using Selenium RC you can call AutoIt just before you
execute your Selenium command. On the Grid you will have to make
AutoIt run constantly and "listen" for those pop-ups.

Here is an example of an AutoIt script for closing the Firefox
Security Warning pop-up.

WinWaitActive("[TITLE:Security Warning; CLASS:MozillaDialogClass]","",
10)
If WinExists("[TITLE:Security Warning; CLASS:MozillaDialogClass]")
Then
WinActivate("[TITLE:Security Warning; CLASS:MozillaDialogClass]")
Send("{ENTER}")
EndIf

Jminne

unread,
Mar 25, 2010, 12:49:39 PM3/25/10
to Selenium Users
Thanks for the example Martin.

I just wanted to re-iterate for others out there that autoit is
probably the best solution out there right now for dealing with
downloads directly from firefox and IE. Of course downloading the
file directly from a separate library is best. But I could not just
use a python library like urllib since my download requires
authentication.

If you're using pythonRC calfdog has made some progress doing the IE
automation, but it requires 5 libraries and doesn't work on firefox.
http://groups.google.com/group/selenium-users/browse_thread/thread/74e19d813372e40/ddc8fd6a5a348687

Here's some autoit scripts for saving firefox and IE to the default
location . Make sure to delete the file if it already exists or else
you'll get the overwrite prompt. I compiled these into exes and now
run them before I attempt a download.

IE:
WinWaitActive("File Download - Security Warning","", 10)
If WinExists("File Download - Security Warning") Then
WinActivate("File Download - Security Warning")
Send("!s")
EndIf
WinWaitActive("Save As", "", 10)
Send("!s")

Firefox:
WinWaitActive("[TITLE:Opening ; CLASS:MozillaDialogClass]","", 10)
If WinExists("[TITLE:Opening ; CLASS:MozillaDialogClass]") Then
WinActivate("[TITLE:Opening ; CLASS:MozillaDialogClass]")
Send("{ENTER}")
EndIf


On Mar 23, 11:37 am, Martin <mlienha...@gmail.com> wrote:
> AutoIt will work for clicking thru those pop-up dialogs.
>
> If you are using Selenium RC you can call AutoIt just before you
> execute your Selenium command. On the Grid you will have to make
> AutoIt run constantly and "listen" for those pop-ups.
>
> Here is an example of an AutoIt script for closing theFirefox
> Security Warning pop-up.
>
> WinWaitActive("[TITLE:Security Warning; CLASS:MozillaDialogClass]","",
> 10)
> If WinExists("[TITLE:Security Warning; CLASS:MozillaDialogClass]")
> Then
>         WinActivate("[TITLE:Security Warning; CLASS:MozillaDialogClass]")
>         Send("{ENTER}")
> EndIf
>
> On Mar 23, 9:17 am, Rajat Jindal <rajatjinda...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > You can issue a selectWindow command to selenium RC server, which
> > accepts the Window's ID as the input and selects the window but this
> > is valid if the popup that you are trying to select is a browser

> > popup.  To select thedownloadwindow which is (probably) a OS window,


> > you will need something like Autoit.
>
> > Never really got a chance to work on Autoit, but heard its really good
> > for such automation.
>
> > Hope it helps.
>
> > Thanks,
> > Rajat Jindal
> > quicksilver1183-tech.blogspot.com
>
> > On Mar 22, 4:16 pm, "Dev.." <devdar...@gmail.com> wrote:
>
> > > Hello
> > >     can anyone let me know how can i handle thefirefox"Download" popup or

> > > any otherfirefoxpopup through selenium with java.

Jminne

unread,
May 14, 2010, 4:15:08 PM5/14/10
to Selenium Users
Someone might find this helpful:
autoit Win* commands only work if there is an active console session.
The work-around for this in automated environment(CI) is to leave a
vnc server like tightVNC with a connection open.

-John

On Mar 25, 11:49 am, Jminne <john.mi...@gmail.com> wrote:
> Thanks for the example Martin.
>
> I just wanted to re-iterate for others out there that autoit is
> probably the best solution out there right now for dealing with
> downloads directly from firefox and IE.  Of course downloading the
> file directly from a separate library is best.  But I could not just
> use a python library like urllib since mydownloadrequires
> authentication.
>
> If you're using pythonRC calfdog has made some progress doing the IE
> automation, but it requires 5 libraries and doesn't work on firefox.http://groups.google.com/group/selenium-users/browse_thread/thread/74...
>
> Here's some autoit scripts for saving firefox and IE to the default
> location .  Make sure to delete the file if it already exists or else
> you'll get the overwrite prompt.  I compiled these into exes and now
> run them before I attempt adownload.
>
> IE:
> WinWaitActive("FileDownload- Security Warning","", 10)
> If WinExists("FileDownload- Security Warning") Then
>         WinActivate("FileDownload- Security Warning")
> > > is valid if thepopupthat you are trying to select is a browser
> > >popup.  To select thedownloadwindow which is (probably) a OS window,
> > > you will need something like Autoit.
>
> > > Never really got a chance to work on Autoit, but heard its really good
> > > for such automation.
>
> > > Hope it helps.
>
> > > Thanks,
> > > Rajat Jindal
> > > quicksilver1183-tech.blogspot.com
>
> > > On Mar 22, 4:16 pm, "Dev.." <devdar...@gmail.com> wrote:
>
> > > > Hello
> > > >     can anyone let me know how can i handle thefirefox"Download"popupor
> > > > any otherfirefoxpopup through selenium with java.
>
> > > > Suggestions will be appreciated.
>
> > > > Regards
> > > > -Dev
>
>

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Elias Nogueira

unread,
May 14, 2010, 5:39:31 PM5/14/10
to seleniu...@googlegroups.com
Hello!
Take a look at this post...
http://qtp-help.blogspot.com/2009/07/selenium-handle-dialogs.html

It have an example with the AutoIT scripts to handle IE and Firefox download popup.

Best regards!
--
Elias Nogueira, CSTE
elias.n...@gmail.com

CSTE - Certified Software Tester
Blog: http://sembugs.blogspot.com
Twitter: http://twitter.com/eliasnogueira
LinkedIn: http://www.linkedin.com/in/eliasnogueira
Reply all
Reply to author
Forward
0 new messages