【发布时间】:2013-12-21 15:22:48
【问题描述】:
我希望编写一个测试来使用 Fluentlenium 和 DropZone.js (http://www.dropzonejs.com/) 上传文件。 Dropzone.js 以模态方式工作,然后您可以通过正常方式拖放或上传。
一旦您点击上传测试就会崩溃,因为您不再在浏览器中。
我发现很多帖子让这个在 Selenium 中使用,例如:
WebElement fileInput = driver.findElement(By.xpath("//input[@type='file']"));
fileInput.sendKeys("C:/path/to/file.jpg");
但是,我无法将密钥发送到任何东西,因为在使用 DropZone.js 时它们甚至不是输入 type="file"。
我看到的唯一输入类型都是隐藏类型。
<input type="hidden" name="key" value="temp/${filename}">
<input type="hidden" name="AWSAccessKeyId" value="secret">
<input type="hidden" name="acl" value="private">
<input type="hidden" name="success_action_redirect" value="">
<input type="hidden" name="policy" value="secret=">
<input type="hidden" name="signature" value="secret">
<input type="hidden" name="Content-Type" value="application">
我们也在使用 Amazon Web Server 来上传文档,似乎一切都在以下脚本中运行:
<script id="hiddenKeyPairs" type="text/javascript">
var hiddenKeyPairs = {
key: 'temp/${filename}',
AWSAccessKeyId: 'secret',
acl: 'private',
"success_action_redirect": '',
policy: 'secret',
signature: 'secret/secret',
"Content-Type": 'application'
};
var formAction = 'https://secret.com/';
</script>
位于我的页面上。
我在https://github.com/FluentLenium/FluentLenium#driver 上没有看到任何对此有帮助。
我是否需要以某种方式将文件发送到上述脚本中的密钥散列?
有什么想法吗?
【问题讨论】:
标签: javascript selenium dropzone.js fluentlenium