我正在使用硒和酱汁实验室进行自动跨浏览器测试。测试的Web应用程序需要通过文件选择器对话框访问文件。我想在Sauce Labs运行测试时使用Selenium访问这些文件。在本地运行测试(不使用酱汁实验室)时,我能够成功与文件选择器对话框进行交互以访问文件,但是当通过酱汁实验室运行测试时,我无法执行此操作,因为我不don' t知道呈现的本机文件选择器对话框的Web元素定位器。
我有以下问题:
- 是否可以将文件上传到Sauce Labs虚拟机上,以后从运行浏览器的虚拟机上的文件系统下载它们?
- 是否有一种方法(使用硒)可以与在酱汁实验室虚拟机上执行测试时呈现的本机文件选择器对话框进行交互?目标是将键盘输入发送到“文件选择器”对话框,并指定文件的路径。
我已经检查了Sauce Labs文档以获取有关此信息的信息。
这些是我引用的文件:
https://support.saucelabs.com/hc/en-us/articles/115003685593-uploading-files-files-files-to-auce-to-auce-labs-virtual-virtual-machine-machine-machine-machine-during-during-a-a-test
是否有人成功地将文件上传到酱汁实验室,并在测试执行过程中通过介绍的本机文件选择器对话框访问了这些文件?
I am performing automated cross-browser testing using Selenium and Sauce Labs. The web application under test requires files to be accessed via a file chooser dialog. I’d like to access these files using Selenium while tests are being run by Sauce Labs. When running the tests locally (without the use of Sauce Labs), I am successfully able to interact with the file chooser dialog to access files, but have not been able to do this when the tests are run via Sauce Labs, since I don’t know the web element locator for the native file chooser dialog that is presented.
I have the following questions:
- Is it possible to upload files to a Sauce Labs virtual machine, to later download them from the filesystem on the virtual machine where the browser is run?
- Is there a way (using Selenium) to interact with the native file chooser dialog that is presented while the test is executing on the Sauce Labs virtual machine? The goal would be to send keyboard input to the file chooser dialog, specifying the path to the file.
I have checked Sauce Labs documentation for information on this.
These are the documents I referenced:
https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
https://support.saucelabs.com/hc/en-us/articles/115005860628-Testing-PDF-Downloads
Has anyone successfully uploaded files to Sauce Labs, and accessed them during test execution via the native file chooser dialog that is presented?
发布评论
评论(1)
是的,这是可能的,您需要采取的步骤在 此存储库。这个示例是用 JavaScript 编写的,但希望您可以将其翻译成您最喜欢的语言。
基本步骤是:
Yes, this is possible, the steps that you need to take are explained in this repository. This example is written with JavaScript, but hopefully you can translate this to your favourite language.
The basic steps are: