3
當rdp會話關閉時,出現黑屏截圖常見問題。 沒有找到任何有關此問題的工作答案。 我有java-selenium測試。 代碼:在遠程計算機上使用robot.createScreenCapture獲取黑色圖像
private void screenShot() {
try {
String newFileNamePath;
File directory = new File (".");
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
Date date = new Date();
newFileNamePath = directory.getCanonicalPath() + "\\test-output\\" + "logs\\" + "screenshot_" + dateFormat.format(date) + ".png";
System.out.println(newFileNamePath);
//Capture the screen shot of the area of the screen defined by the rectangle
Robot robot = new Robot();
BufferedImage bi=robot.createScreenCapture(new Rectangle(1920,1080));
ImageIO.write(bi, "png", new File(newFileNamePath));
Reporter.log(newFileNamePath);
}
catch (AWTException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
當我運行通過詹金斯遠程服務器(Windows Server 2008 R2)和RDP會話被關閉上測試,我得到黑色的屏幕截圖。 如果會話是活動的 - 我得到正常的截圖。 但是,當會話關閉時,我需要製作正常的屏幕截圖。
我該怎麼做? 有什麼建議嗎?
VisualCron和selenium.captureScreenshot()不適合我。
同樣的問題在這裏。在Win 2003上,你可以/ console登錄和'tscon 0/dest:console'來斷開連接。使用VNC是一種解決方案,但我寧願不要。 – Dormouse