How to handle File download dialog/popup in IE browser USING SELENIUM and C#

4,939 views
Skip to first unread message

MsbYuva

unread,
Aug 3, 2015, 1:23:15 PM8/3/15
to Selenium Users

I have page which downloads a file which shows a dialog on the bottom with OPEN SAVE CANCEL options, how can I click those options ? I am using IE browser, I saw some solutions using third party AutoIt, Robot class, but I am looking with Selenium and C# only. Attached is the image of what I am talking.. Any idea how can we do this ?

Krishnan Mahadevan

unread,
Aug 3, 2015, 1:59:41 PM8/3/15
to Selenium Users

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Sat, Aug 1, 2015 at 1:32 AM, MsbYuva <sudhe...@gmail.com> wrote:

I have page which downloads a file which shows a dialog on the bottom with OPEN SAVE CANCEL options, how can I click those options ? I am using IE browser, I saw some solutions using third party AutoIt, Robot class, but I am looking with Selenium and C# only. Attached is the image of what I am talking.. Any idea how can we do this ?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bd07f2bf-4172-42bc-9a14-d7654acff1a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kaleem Uddin Mohammed Abdul

unread,
Aug 4, 2015, 1:46:44 AM8/4/15
to Selenium Users
I have automated this using AutoIT in my project. The below is the same code.
        public void SaveExcel(string FileName)
        {
            try
            {
                #region Excel Export
                //Visit this site for Auto IT details https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm
                IAutoItX3 Autoit = new AutoItX3Class();
                string WindowsTitle = string.Empty;
                if (_Constants.WebDriver == Constants.FireFoxText)
                {
                    WindowsTitle = Constants.OpeningText + FileName + Constants.ExcelExtension;
                }
                else if (_Constants.WebDriver == Constants.IEText)
                {
                    WindowsTitle = Constants.IEDialogName;
                }
                int Counter = 1;

                Autoit.AutoItSetOption(Constants.AutoITMatchMode, 2);
                Autoit.WinWait(WindowsTitle, string.Empty, 2);
                while (Counter <= 5)
                {
                    if ((Autoit.WinExists(WindowsTitle) != 0))
                    {
                        if (_Constants.WebDriver == Constants.FireFoxText)
                        {
                            Autoit.WinActivate(WindowsTitle);
                            Autoit.Send(Constants.DownKey);
                            Autoit.WinActivate(WindowsTitle);
                            Autoit.Send(Constants.TabKey + Constants.TabKey + Constants.TabKey);
                            Autoit.WinActivate(WindowsTitle);
                            Autoit.Send(Constants.EnterKey);
                            break;
                        }
                        else if (_Constants.WebDriver == Constants.IEText)
                        {
                            Autoit.WinActivate(WindowsTitle);
                            System.Threading.Thread.Sleep(2000);
                            //sendiing Alt+s
                            Autoit.Send(Constants.AutoITAlt_S);
                            break;
                        }
                    }
                    System.Threading.Thread.Sleep(1000);
                    Counter++;
                }
                #endregion
            }
            catch (Exception Ex)
            {
                throw Ex;

Deepak Jangid

unread,
Apr 17, 2018, 6:34:29 AM4/17/18
to Selenium Users
I use this code but It show error that is "the name constants does not exist in current context"
Reply all
Reply to author
Forward
0 new messages