使用Selenium IDE Firefox插件的屏幕截图

use*_*194 6 selenium screenshot firefox-addon

使用Selenium IDE Firefox插件,我想采用自动截图.测试脚本包含两行:

Command: open; Target: http://www.google.com
Command: captureEntirePageScreenshotAndWait
Run Code Online (Sandbox Code Playgroud)

日志显示:

[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
Run Code Online (Sandbox Code Playgroud)

如何获取截图?

use*_*194 10

正确设置文件路径解决了它.路径需要设置如下:

(视窗:)

Command: captureEntirePageScreenshotAndWait; Target: D:\\Screenshots\\test.png
Run Code Online (Sandbox Code Playgroud)

(Linux的:)

Command: captureEntirePageScreenshotAndWait; Target: \\Screenshots\\test.png
Run Code Online (Sandbox Code Playgroud)

在此示例中,必须存在"屏幕截图"文件夹.