我试图使用Selenium WebDriver
上传文件。问题是硒没有发送文件路径到对话窗口。我正在使用SendKeys()
。这里是我的代码:使用Selenium WebDriver上传文件 - 无法与对话框窗口交互C#
Click.DsrSubmitNewActivityToolPage.AttachmentButton();
Thread.Sleep(4000);
Actions action = new Actions(PageElements.Driver);
action.SendKeys("C:/Users/gk/Documents/Test/Test Test.docx");
action.SendKeys(Keys.Enter);
Thread.Sleep(4000);
这里是HTML:
<div class="activity yui3-g">
<div class="label yui3-u-1-5">
<span>Attachment:</span>
</div>
<div class="yui3-u-4-5">
<input id="fileID" type="file" name="file"/>
</div>
</div>
<div id="pointValueContainer" class="activity yui3-g" style="display:none">
<span class="label">Notes</span>
<div class="activity">
<p>
你能提供'html'吗? – Saifur 2015-02-11 17:50:24
@Gala_De你缺少'.Perform()'方法调用来完成操作。 – 2015-02-11 18:05:38
感谢您的回复@Vivek Singh。为了您的方便,我附上了html。 – 2015-02-13 22:05:20