【发布时间】:2020-10-12 16:45:41
【问题描述】:
尝试使用 chromedriver 上传文件 我 findelement 浏览按钮和 Click() 上传文件 输入路径的新窗口打开我使用 SendKyes 没有键入文件路径
WebElement fileInput = driver.findElement(By.name("btnChooseFiles")); fileInput.sendKeys("C:/path/to/file.jpg");
这里是 HTML 代码
<div style="height: inherit; vertical-align: middle; display: table-cell;">
<input name="fileInput" type="file" id="fileInput" onpropertychange="add()" style="position: absolute; visibility: hidden;" multiple="true">
<input type="submit" name="btnChooseFiles" value="Browse..." onclick="fileInput.click();return false;" id="btnChooseFiles" class="bluebutton bluebutton32 browsebutton">
</div>
【问题讨论】:
标签: c# selenium-webdriver