我试图通过Selenium进行简历上传。 我在页面上有2个按钮"添加文件"和"上传"
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();