我目前正在通过 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
所以不要使用 $this->attachFile('file', 'file://test.png')
我用过了:
$this->type('file', '/path/to/file');
它有效! :)
关于file-upload - Selenium、PHPUnit 和 AttachFile(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7168604/