file-upload - Selenium、PHPUnit 和 AttachFile()

标签 file-upload selenium phpunit

我目前正在通过 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/

相关文章:

java - 如何使用java通过TransferManager在S3上上传文件时使文件权限为 "read public"?

python - Selenium - 无法点击隐藏元素

php - 如何在使用 PHPUnit、Selenium 和 php-webdriver 进行测试后保持登录状态

phpunit 检查日志文件

php - 引用用户上传的文件 - 数据库还是文件名?

javascript for循环只上传一个文件

selenium - 使用 Selenium Webdriver 检查占位符文本

php - ZF2 教程专辑 PHPUnit 测试因未定义属性而失败:AlbumTest\Model\AlbumTableTest::$controller

javascript - Angular - Node Express - 大图像上传问题

javascript - Python Selenium 按钮未被点击