Selenium、PHPUnit 和 AttachFile()

2024-01-07

我目前正在通过 PHPUnit 将 Selenium 命令运行到远程服务器。我在尝试将图像上传到输入表单时遇到了问题。

在我的 PHPUnit 中,我有命令

$this->attachFile( 'file', 'file://test.png' );

我的 Selenium 服务器返回错误

PHPUnit_Framework_Exception: Response from Selenium RC server for testComplete().
java.lang.RuntimeException: Output already exists: /tmp/selenium2070373138020433468upload.

我的 test.png 文件当前仅位于我执行 .php 单元测试的文件夹中。

如何通过 PHPUnit 和 Selenium 正确上传文件并使其不引发异常?


我有同样的问题。然后我找到了这篇文章:http://bitsilearn.blogspot.com/2010/03/selenium-upload-files.html http://bitsilearn.blogspot.com/2010/03/selenium-upload-files.html

所以不要使用$this->attachFile('file', 'file://test.png')我用过了:

$this->type('file', '/path/to/file');

它有效! :)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Selenium、PHPUnit 和 AttachFile() 的相关文章

随机推荐