How to upload file using Selenium Webdriver? RRS feed

  • Question

  • Hi,

    I am trying to upload a file using Selenium Webdriver on the Edge browser, and yes I have downloaded EdgeDriver and installed the MSI for testing Edge. Clicking on elements on the screen from within the Edge browser works fine. The problem is the upload file control. My code is as follows:

    IWebElement fileUploader2 = Browser.Driver.FindElements(By.CssSelector("input[type='file']"))[0];
            fileUploader2.SendKeys(FileUtility.FileUploadsDirectory + "\\sample-account_balances.xlsx");

    The code above works for Chrome and Firefox, but does not work for Edge. This is a ReactJS web app. I have tried the suggestions below that are similar to my code above and I cannot seem to upload a file using the control programmatically from Selenium Webdriver. There is no error given it just does not click on send text to the file upload control. Nothing is executed:

    DOM for Upload Control

    Upload Control

    Thursday, August 4, 2016 11:52 AM