0

I'm trying to do a resume upload via Selenium. I have 2 buttons on the page "Add File" and "Upload"

Html:

<input type="file" name="uploadedfile" aria-labelledby="Uploader_0_label" accept=".doc, .docx, .pdf, .html, .htm, .wks, .txt" style="position: absolute; font-size: 2em; top: -3px; right: -3px; cursor: pointer; opacity: 0;" tabindex="-1" aria-disabled="false"/>


"<span id="Button_9_label" class="dijitReset dijitInline dijitButtonText" data-dojo-attach-point="containerNode">Upload</span>"

C# Selenium:

 string newPath = filepath.Replace("\\\\","\\");
            Driver.FindElement(By.XPath("//input[@name='uploadedfile' and @type='file']")).SendKeys(newPath);
            Driver.FindElement(By.XPath("//span[text()='Upload']")).Click();
Arwaa Rasool
  • 49
  • 10
  • Try this: http://stackoverflow.com/questions/35799213/selenium-webdriver-c-sharp-is-it-possible-to-attach-a-file-to-upload – Dazed Jan 17 '17 at 01:17
  • You don't need to click upload button after sendKeys – Sakshi Singla Jan 17 '17 at 06:59
  • I tried it but doesn't work. The thing is that the upload dialog is opened when i click select a file. After send keys the add file button looks disabled so I need to click something to close the dialog. I don't have any control over the html code so I can't change the way it works. – Arwaa Rasool Jan 17 '17 at 16:01

0 Answers0