How to Upload file in Selenium WebDriver using AutoIT
Why Stack Overflow recommends it
Stack Overflow users link it when Selenium cannot reach native Windows dialogs such as file pickers and authentication popups, and an AutoIt script is the workaround.
Recommended by 2 people across 2 different months, 2015 to 2017.
What it is
A 17-minute tutorial by Mukesh Otwani on uploading files in Selenium WebDriver by driving the native Windows file dialog with AutoIt. It covers installing AutoIt, writing and compiling a script, and calling the compiled executable from a Selenium test in Java, C# or another language.
What people said
Recommends Richard77 · 2015-06 · Stack Overflow · on “Where does default USER PROFILE for the Internet Explorer lives and how do I access it from Selenium?”
After straggling with this problem for days, I've finally found a solution on YouTube [this video] which helped me solve it, at least when it comes to Internet Explorer. I'm still looking for an appropriate solution in Chrome. One need to download AutoIT [LINK] as it said in the video write an AutoIT script, save it, and compile it to produce a executable file as shown in the video Add an command to execute the AutoIT in the context of your automation. The last step in the most critical of all. In my case, I've put in the Open Method because it's when I open a page that I get prompted with a authentication popup. public virtual void Open( string urlParam = "") { driver.Navigate().GoToUrl(Expected
Recommends user6034802 · 2015-11 · Stack Overflow · on “Drag and drop local file in browser with Selenium WebDriver and JUnit?”
Thank you for your kind answer. I tried the Robot class this morning, but it wasn't able to cope with local files. I eventually found this video [this video] , and I'm now working my problem out. Fortunately AutoIt (which is a little bit like Sikuli I guess) can be plugged in Selenium. Thanks anyway!
Cites Ashok · 2017-05 · Stack Overflow · on “How to fill Authentication Required popup in chrome with Selenium C#”
Here is how I figured out. 1 - Added AutoIt NuGet package to project. 2 - Used as below: IWebDriver driverIE = new InternetExplorerDriver(); driverIE.Manage().Window.Maximize(); driverIE.Navigate().GoToUrl(@" [LINK] "); AutoItX.ControlFocus("Windows Security", "", "Edit1"); AutoItX.ControlSetText("Windows Security", "", "Edit1","userid"); AutoItX.ControlFocus("Windows Security", "", "Edit2"); AutoItX.ControlSetText("Windows Security", "", "Edit2", "password"); AutoItX.ControlClick("Windows Security", "", "Button2"); //Do your work. driverIE.Dispose(); Tutorials I followed. Tutorial 1 [this video] and Tutorial 2 [LINK]