How to handle file upload dialog / popup in IE browser USING SELENIUM and C #

I have a page that loads a file, at the bottom of which a dialog box appears with the options OPEN SAVE CANCEL, how can I click these options? I use IE browser, I saw some solutions using third-party AutoIt, Robot class, but I only look with Selenium and C #. Attached image of what I'm talking about. Any ideas how we can do this? enter image description here

+7
source share
2 answers

You can try this code.

using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.IE; using OpenQA.Selenium.Support.UI; using System.Threading; using System.Collections.Generic; using System.Windows.Forms; //using NUnit.Framework; namespace SampleTest { [TestMethod] public void Download() { IWebDriver driver = new InternetExplorerDriver(@"C:\Users\hamit\Desktop\Selenium\IEDriverServer_Win32_2.48.0"); driver.Navigate().GoToUrl("https://www.spotify.com/se/download/windows/"); Thread.Sleep(2000); SendKeys.SendWait("@{TAB}"); Thread.Sleep(100); SendKeys.SendWait("@{TAB}"); Thread.Sleep(100); SendKeys.SendWait("@{DOWN}"); Thread.Sleep(100); SendKeys.SendWait("@{DOWN}"); Thread.Sleep(100); SendKeys.SendWait("@{Enter}"); } } 
0
source
  AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Save"); Thread.Sleep(1000); autoit.Send("{F6}"); Thread.Sleep(1000); autoit.Send("{TAB}"); Thread.Sleep(1000); autoit.Send("{ENTER}"); 
-one
source

All Articles