Selenium Webdriver文件附件 [英] Selenium Webdriver file attachments

查看:217
本文介绍了Selenium Webdriver文件附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用eclipse做selenium webdriver的一些自动化测试。我需要附加实际文件,然后发送。问题是这些文件不能在我的本地驱动器上,因为完成的测试被上传到服务器,以便它们可以连续运行,并且与本地文件的连接将丢失,导致测试失败。有没有一种方法,包括在某些文件夹中的Eclipse项目,这些测试文件,然后使用测试连接或上传这些文件?


解决方案

是的,您可以将文件存储在eclipse项目的资源或res文件夹中,然后使用相对路径引用这些文件。在这种情况下,您将使这些文件成为您的存储库的一部分。



另一种方法是在一个共享文件夹,点中的所有文件从测试的情况下离开这些,所以在这种情况下,你并不需要将文件提交给存储库,我们曾经用大文件进行存储。


I'm doing some automated testing with selenium webdriver in eclipse. I need to attach actual files and then send them. The problem is these files can't be on my local drive since the completed tests are uploaded to a server so that they can be ran continuously and the connection to my local files will be lost causing the tests to fail. Is there a way to include these test files in the eclipse project in some folder then use the tests to attach or upload these files?

解决方案

Yes, you can store the files in the resources or res folder of your eclipse project and then reference these using relative paths. In that case you will be making these files part of your repository.

Another way is to leave all the files in a shared folder and point to these from the test cases, so in that case you don't need to commit the files to the repository, we used to make that with big files.

这篇关于Selenium Webdriver文件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆