2013-08-05 110 views
0

我需要能夠截取網頁截圖並將其保存到我的硬盤上的文件夾中。爲此,我嘗試使用captureEntirePageScreenshot,將我要用作目標的文件夾。selenium ide截圖保存失敗

<tr> 
<td>captureEntirePageScreenshot</td> 
<td>C:\Users\.....\Desktop\test</td> 
<td></td> 
    </tr> 

當我告訴它執行時,出現以下錯誤。注意:selenium上的基本URL和網頁匹配。

[error] Unexpected Exception: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFileOutputStream.init]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" location: "JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: <TOP_LEVEL> :: line 2986" data: no]. QueryInterface -> function QueryInterface() { [native code] }, message -> Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFileOutputStream.init], result -> 2152857621, name -> NS_ERROR_FILE_ACCESS_DENIED, filename -> chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js, lineNumber -> 2986, columnNumber -> 0, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: <TOP_LEVEL> :: line 2986, inner -> null, data -> null, initialize -> function initialize() { [native code] } 

如果有人能幫助我理解這一點並解決它,我將不勝感激。

+0

你有什麼版本的Firefox以及哪個版本的IDE?這是否剛剛開始?它之前工作過嗎? Firefox最近升級了嗎?你在其他機器上遇到問題嗎? – Arran

+0

firefox:22.0;硒:2.2.0;我不知道這是否剛剛開始,或者我的同事遇到類似的問題,因爲我/我們現在不需要保存屏幕截圖。最近的Firefox升級是上個月。 – Skulgren

+0

更正:我們應用的最新Firefox升級是在上個月完成的。 – Skulgren

回答

0

試試這個,讓我知道它是否適合你的工作或沒有,因爲這對我來說

 <tr> 
<td>open</td> 
<td>http://docs.seleniumhq.org/download/</td> 
<td></td> 
     </tr> 
    <tr> 
<td>captureEntirePageScreenshot</td> 
<td>d:/title.png</td> 
<td></td> 
    </tr> 
+0

它沒有。我收到了類似的錯誤消息: – Skulgren

+0

[錯誤]意外的異常:[Exception ...「組件返回失敗代碼:0x80004005(NS_ERROR_FAILURE)} [nsIFileOutputStream.init]」nsresult:「0x80004005(NS_ERROR_FAILURE)」位置: 「JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: :: line 2986」data:no]。 – Skulgren

+0

消息 - >組件返回失敗代碼:0x80004005(NS_ERROR_FAILURE)[nsIFileOutputStream.init],QueryInterface - >函數QueryInterface(){[本機代碼]},結果 - > 2147500037,名稱 - > NS_ERROR_FAILURE,文件名 - > chrome:// selenium-ide/content/selenium-core/scripts/selenium-api.js,lineNumber - > 2986,columnNumber - > 0,location - > JS frame :: chrome:// selenium-ide/content/selenium-core/scripts /selenium-api.js :: ::第2986行,內部 - > null,數據 - > null,初始化 - >函數initialize(){[native code] – Skulgren

0

嗯,我使用的硒2.2.0做工精細,但我在Firefox 17.0.1和下面的命令適用於我。

captureEntirePageScreenshot | c:\selenium\test.jpg | 

請注意,它可以使用或不使用文件擴展名。你可能想用seleniumhq.org進行檢查,看是否有與在Firefox 22

Klendathu

該命令
+0

值得一試,但仍然沒有雪茄。不管怎麼說,還是要謝謝你。 – Skulgren

0

嘗試加倍後從\斜線中的文件路徑\\一個報告的問題。

<tr> 
<td>captureEntirePageScreenshot</td> 
<td>C:\\Users\\.....\\Desktop\\test</td> 
<td></td> 
</tr> 

希望有幫助。

相關問題