2014-04-02 4 views
3

rdp 세션이 닫힐 때 검은 스크린 샷이 나타나는 일반적인 문제가 있습니다. 이 문제에 대한 답변을 찾지 못했습니다. java-selenium 테스트가 있습니다. 코드 : 나는 을 폐쇄 원격 서버 (윈도우 서버 2008 R2) 및 RDP 세션에 젠킨스를 통해 테스트를 실행하면원격 컴퓨터에서 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(); 
    } 
    } 

, 나는 검은 스크린 샷을 얻을. 세션이 활성화되어 있으면 정상적인 스크린 샷을 얻습니다. 하지만 세션이 닫힐 때 정상적인 스크린 샷을 만들어야합니다.

어떻게 만들 수 있습니까? 아이디어가 있으십니까?

VisualCron 및 selenium.captureScreenshot()은 저에게 적합하지 않습니다.

+0

같은 문제가 있습니다. Windows 2003에서는/console login과'tscon 0/dest : console'을 연결 해제 할 수 있습니다. VNC를 사용하는 것이 해결책이지만, 나는 그렇지 않을 것입니다. – Dormouse

답변

0

나는 VNC 서버를 사용하는 것에 대한 대안을 찾고 있었지만 찾지 못했습니다. 그래서 내 대답은 "Use VNC"입니다. 개인적으로 나는 UltraVNC을 선호합니다.

설치되면 uvnc 세션을 사용하여 셀레늄 젠킨스 슬레이브를 시작하고 연결을 끊습니다.

이제 AWT Robot이 작동합니다.