In a series of applications my team is building we would like to test our import and export functionality which requires the respective upload and download to be automated.
The functionality is simple but tied to the UI; the end-user needs to be able to click on a button on the web UI and then the resultant export file is downloaded. With uploads, the idea is to have a local file relevant to the application and then use the web UI to upload said file and then test the import functionality.
Ideally I am looking for the ability to do this via Selenium IDE but as I understand it that is not possible.
Can this be done via Selenium WebDriver (via C#)?
If not, what is the best strategy to test this functionality? I'd like to test this as the end user and not simply pointing to some back-end URL to perform these tests.
Thank you for your time.
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("browser.download.folderList",2);
profile.SetPreference("browser.download.manager.showWhenStarting",false);
profile.SetPreference("browser.download.dir", @"c:\path\to\downloads\folder");
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk","MIME/TYPE");
FirefoxDriver driver = new FirefoxDriver(profile);
driver.Get("http://path/of/your.file");
IWebElement element = FindElement(By.Locator.of.your.file.type.input);
element.SendKeys(@"c:\full\path\to\file\for.upload.txt");