use*_*418 9 shell firefox headless
使用shell_exec与Xvfb和FireFox当前捕获屏幕截图.但是,需要使用shell_exec将整个html(例如,将页面另存为 - >网页完成.)下载到目录.已经查看了Mozilla开发人员论坛中提供的所有不同选项,但未能弄清楚如何执行此操作.
这段代码似乎是我可能需要的,但是在哪里以及如何实现它以便可以在shell_exec中访问它?
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("C:\\filename.html");
var wbp = Components.classes['@mozilla.org/embedding/browser/nsWebBrowserPersist;1']
.createInstance(Components.interfaces.nsIWebBrowserPersist);
wbp.saveDocument(content.document, file, null, null, null, null);
Run Code Online (Sandbox Code Playgroud)
void saveDocument(
in nsIDOMDocument aDocument,
in nsISupports aFile,
in nsISupports aDataPath,
in string aOutputContentType,
in unsigned long aEncodingFlags,
in unsigned long aWrapColumn
);
Run Code Online (Sandbox Code Playgroud)
这里有一个Stackoverflow手动解决方案,但它没有解决shell_exec: 如何在本地保存网页,包括图片等
我知道的选项很少,但我知道没有一个选项完全适合您的问题。
firefox http://yoursite.com,然后使用或类似的方法将击键发送到 firefox xte。(但这不是无头模式。)http://some-fake-page.com/?download=http://yoursite.com,然后使用该假页面url打开firefox。可能还有其他更好的选择,但我不知道。