Can you upload remote files with intern leadfoot

蓝咒 提交于 2020-01-17 03:14:04

问题


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?


回答1:


Leadfoot handles file uploads like this:

  1. 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 using require.toUrl (e.g., element.type(require.toUrl('./someFile.txt'))).
  2. Leadfoot silently uploads the file to the remote Selenium/WebDriver server and determines its path on the remote system.
  3. 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).



来源:https://stackoverflow.com/questions/37217884/can-you-upload-remote-files-with-intern-leadfoot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!