Selenium RC 不会在 VMWare 上保存屏幕截图
我正在 VMWare (Workstation 7.0.0 build-203739) 虚拟机 (Windows XP Professional SP3) 上运行 Selenium RC (selenium-server-standalone-2.0b2.jar)。
我使用 Bromine 在该硒服务器上运行测试。其中一个测试包含 captureEntirePageScreenshot 命令来保存屏幕截图:
captureEntirePageScreenshot("c:/Temp/Screenshot.png", "")
该命令被传递到 Selenium 服务器并且报告正常:
14:33:28.312 INFO - Command request: captureEntirePageScreenshot[C:/Temp/Screenshot.png, ] on session 1e301bb6dca4481ba007225fb4ef4f84
14:33:28.406 INFO - Got result: [base64 encoded PNG] on session 1e301bb6dca4481ba007225fb4ef4f84
14:33:30.937 INFO - Command request: testComplete[, ] on session 1e301bb6dca4481ba007225fb4ef4f84
但此后 c:/Temp 中没有屏幕截图。
我也尝试过 captureEntirePageScreenshotToString() 命令,它返回一个像这样的字符串(而不是返回一个 base64 编码的 png):
OR: java.io.FileNotFoundException: C:\DOCUME~1\Black\LOCALS~1\Temp\customProfileDir0be0044d90b44d63bcc746e8e6c79b10\screenshots\page-screenshot-0be0044d90b44d63bcc746e8e6c79b10.png (File not found)
我的结论是运行它的 Selenium 或 JRE(版本 1.6.0_24)无法将文件写入磁盘以生成屏幕截图。任何帮助将不胜感激!提前致谢。
运行 Selenium 服务器的虚拟机没有可能阻止写入磁盘的防火墙/防病毒软件,它是干净的 Windows XP 安装。
I am running a Selenium RC (selenium-server-standalone-2.0b2.jar) on a VMWare (Workstation 7.0.0 build-203739) Virtual Machine (Windows XP Professional SP3).
I run tests on this selenium server using Bromine. One of the tests contains a captureEntirePageScreenshot command to save a screenshot:
captureEntirePageScreenshot("c:/Temp/Screenshot.png", "")
This command is passed to Selenium server and it reports ok:
14:33:28.312 INFO - Command request: captureEntirePageScreenshot[C:/Temp/Screenshot.png, ] on session 1e301bb6dca4481ba007225fb4ef4f84
14:33:28.406 INFO - Got result: [base64 encoded PNG] on session 1e301bb6dca4481ba007225fb4ef4f84
14:33:30.937 INFO - Command request: testComplete[, ] on session 1e301bb6dca4481ba007225fb4ef4f84
But there is no screenshot in c:/Temp after this.
I have also tried captureEntirePageScreenshotToString() command, and it returns a string like this (instead of returning a base64-encoded png):
OR: java.io.FileNotFoundException: C:\DOCUME~1\Black\LOCALS~1\Temp\customProfileDir0be0044d90b44d63bcc746e8e6c79b10\screenshots\page-screenshot-0be0044d90b44d63bcc746e8e6c79b10.png (File not found)
I conclude that either Selenium or JRE that runs it (version 1.6.0_24) can't write the file to disk in order to produce the screenshot. Any help would be greatly appreciated! Thanks in advance.
The Virtual Machine running the Selenium server has no Firewall / Antivirus software that could prevent writing to disk, it's a clean Windows XP install.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过从测试中调用 SnagIt Com Server 解决了这个问题(它们是用 PHP 编写的) )。因此,我可以在任何浏览器中截取屏幕截图,还可以通过向下滚动来捕获整个页面。至此问题就解决了。无论如何,感谢所有发布答案的人。
I resolved this by calling SnagIt Com Server from my tests (they are written in PHP). Thus, I get the ability to take screenshots in any browser, and also capture the entire page by scrolling down. So far by problem is solved. Thanks to everyone who posted answers, anyway.
我曾经遇到过这个问题。将我的浏览器升级到 FF4 时。发生这种情况主要是由于 Firefox 配置文件。如果您使用自定义配置文件,请删除现有配置文件并创建新配置文件。如果您不使用自定义配置文件,请在创建配置文件后运行测试。这应该可以解决这个问题。
I have encountered this issue once. While upgrading my browser to FF4. This happens mostly due to firefox profile. If you are using a custom profile, delete the existing one and create a new one. If you are not using a custom profile, run the tests after creating one. That should resolve this issue.