selenium.captureEntirePageScreenshot 不起作用,但 selenium.captureScreenshot 起作用
我正在使用 Eclipse 和 Selenium RC 运行 Selenium 和 TestNG。我使用命令:
selenium.captureEntirePageScreenshot("\\test.png","");
但出现以下错误:
com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]
有人可以建议为什么会出现此错误吗?我已经尝试过以下操作:
1)将“”(字符串 kwargs 参数)替换为“background=#CCFFDD”
2)在 Firefox 中以 chrome 模式运行
3)将路径更改为以下值,但我仍然收到错误: “\测试.jpg”, “c:\test.jpg”, “c:\测试.png”, "c:\folder1\test.png",(folder1 存在) "c:\folder1\test.jpg",
4)尝试使用 - selenium.captureScreenshot("\test.png");它工作正常,但它没有解决我的目的,我不想使用 awt。
有人可以建议可能出了什么问题吗?
谢谢,
无限
I'm running Selenium with TestNG using Eclipse and Selenium RC. I used the command:
selenium.captureEntirePageScreenshot("\\test.png","");
but got the following error:
com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]
Can someone please suggest why this error is occuring? I have already tried the following:
1)Replaced "" (String kwargs parameter) with "background=#CCFFDD"
2)Running in Firefox in chrome mode
3)Changed the path to the following values and I'm still getting the error:
"\test.jpg",
"c:\test.jpg",
"c:\test.png",
"c:\folder1\test.png", (folder1 exists)
"c:\folder1\test.jpg",
4)Tried with - selenium.captureScreenshot("\test.png"); and it works fine but it does not solve my purpose and I dont want to use awt.
Can someone please suggest what could be wrong?
Thanks,
Mugen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
更好的是......
我遇到了类似的问题,我只能访问相对路径而不是绝对路径。这是我想出的解决方案:
它将整个页面的屏幕截图放入与项目相关的
reports
目录中。我使用方法名称作为文件名,或者如果将 null 发送到方法则使用当前时间。Better yet...
I ran into a similar issue, where I only had access to a relative path instead of an absolute one. Here is the solution I came up with:
Which will put a screen shot of the entire page into the
reports
directory that is relative to the project. I am using the method name as the file name, or the current time if null is sent to the method.试试这个:
Try this:
对于任何可能涉及的人来说。在我继续摆弄代码一段时间并重新启动系统后,问题得到解决。我开始知道 captureEntirePageScreenshot 仅适用于绝对路径,因此我确保我一直在尝试这一点。
To whomsoever it may concern,. the problem was solved after I kept fiddling with the code for a while and restarted my system. I came to know that captureEntirePageScreenshot works only on absolute paths so I made sure I kept trying with just that.
看了这个页面后我就开始工作了。
http://ashishbhatt.wordpress.com/2010/02 /03/using-captureentirepagescreenshot-with-selenium/
I got it working after looking at this page.
http://ashishbhatt.wordpress.com/2010/02/03/using-captureentirepagescreenshot-with-selenium/