Screenshots using Selenium IDE Firefox plugin

2019-01-24 14:40发布

问题:

Using Selenium IDE Firefox plugin, I want to take automated screenshots. The test script contains of two lines:

Command: open; Target: http://www.google.com
Command: captureEntirePageScreenshotAndWait

The log shows:

[info] Executing: |open | http://www.google.com | |
[info] Executing: |captureEntirePageScreenshotAndWait | | | 
[error] Unexpected Exception: [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: <TOP_LEVEL> :: line 3045" data: no]. toString -> function toString() { [native code] }, message -> Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath], result -> 2152857601, name -> NS_ERROR_FILE_UNRECOGNIZED_PATH, filename -> chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js, lineNumber -> 3045, columnNumber -> 0, inner -> null, data -> null, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: <TOP_LEVEL> :: line 3045

How to get screenshots?

回答1:

Setting the file path correctly solved it. The path needs to be set as follows:

(Windows:)

Command: captureEntirePageScreenshotAndWait; Target: D:\\Screenshots\\test.png

(Linux:)

Command: captureEntirePageScreenshotAndWait; Target: \\Screenshots\\test.png

In this example, the folder 'Screenshots' must exist.