您可以使用实习生Leadfoot上传远程文件吗 [英] Can you upload remote files with intern leadfoot
问题描述
我正在测试文件上传功能,并尝试上传远程文件(例如 https://s3. amazonaws.com/some_dir/some_file ).使用type()会引发错误,指出路径不是绝对的.实习生支持吗?如果是,该怎么办?
I'm testing a file upload feature and trying to upload remote files(e.g. https://s3.amazonaws.com/some_dir/some_file). Using type() throws an error stating the path is not absolute. Is this supported by intern? If yes, how should it be done?
推荐答案
Leadfoot处理文件上传是这样的:
Leadfoot handles file uploads like this:
- 该测试使用文件的本地(到Intern)路径在文件输入元素上调用
type
.该文件必须在运行Intern的系统上存在.您可以使用require.toUrl
(例如,element.type(require.toUrl('./someFile.txt'))
)获得指向它的绝对路径. - Leadfoot静默将文件上传到远程Selenium/WebDriver服务器,并确定其在远程系统上的路径.
- Leadfoot使用远程服务器上新上传的文件的路径在输入元素上调用
sendKeys
.
- The test calls
type
on a file input element with the local (to Intern) path of a file. This file must exist on the system running Intern. You can get an absolute path to it by usingrequire.toUrl
(e.g.,element.type(require.toUrl('./someFile.txt'))
). - Leadfoot silently uploads the file to the remote Selenium/WebDriver server and determines its path on the remote system.
- Leadfoot calls
sendKeys
on the input element using the path of the newly uploaded file on the remote server.
最终目标是使远程浏览器能够为输入的文件选择一个文件并将其发送到某个地方.为此,该文件必须存在于远程系统(运行正在测试的浏览器的文件)上.
The end goal is for the remote browser to be able to select a file for a file input and send it somewhere. For that to work, the file must exist on the remote system (the one running the browser being tested).
这篇关于您可以使用实习生Leadfoot上传远程文件吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!