我正在尝试捕获整个浏览器屏幕的屏幕截图(例如,使用任何工具栏、面板等),而不仅仅是整个页面,所以我得到了以下代码:
using (FirefoxDriver driver = new FirefoxDriver())
{
driver.Navigate().GoToUrl(url);
ScreenCapture sc = new ScreenCapture();
// How can I find natural IntPtr handle of window here, using GUID-like identifier returning by driver.currentWindowHandle?
Image img = sc.CaptureWindow(...);
MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Jpeg);
return new FileStreamResult(ms, "image/jpeg");
}