Selenium.captureEntirePageScreenshot doesn't work but selenium.captureScreenshot works
I am running selenium from 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 ask why this error is happening? I've already tried the following:
1) Replaced "(String kwargs parameter) with" background = # CCFFDD "
2) Working in Firefox mode in chrome mode
3) Changed the path to the following values ββand I still get the error: "\ Test.jpg", "C: \ test.jpg", "C: \ test.png", "c: \ folder1 \ test.png" , (folder1 exists) "C: \ folder1 \ test.jpg",
4) Tried it - selenium.captureScreenshot ("\ test.png"); and it works fine, but that doesn't solve my purpose and I don't want to use awt.
Can anyone suggest what might be wrong?
Thanks,
Mugen
source to share
Better...
I ran into a similar problem where I only had access to a relative path, not an absolute one. Here is the solution I came up with:
public void saveScreenshot(String methodName) {
if (methodName == null) {
methodName = String.valueOf(System.currentTimeMillis());
}
File f = new File("reports" + File.separator + methodName + ".jpg");
selenium.captureEntirePageScreenshot(f.getAbsolutePath(), "");
}
A screenshot of the entire page will be placed in the directory reports
associated with the project. I use the method name as the filename or the current time if null is sent to the method.
source to share
I started working after viewing this page.
http://ashishbhatt.wordpress.com/2010/02/03/using-captureentirepagescreenshot-with-selenium/
source to share