ScreenCaptureTest.java :  » Testing » watij » watij » Java Open Source

Java Open Source » Testing » watij 
watij » watij » ScreenCaptureTest.java
package watij;

import java.io.File;

public class ScreenCaptureTest extends WatijTestCase {
    protected void setUp() throws Exception {
        super.setUp();
        ie.goTo(HTML_ROOT + "buttons1.html");
    }

    public void testScreenCaptureDefaultFormat() throws Exception {
        String pngFileName = "C:/testButtons.png";
        File file = new File(pngFileName);
        if (file.exists()) {
            file.delete();
        }
        ie.screenCapture(pngFileName);
        assertTrue(file.exists());
    }

    public void testWindowCaptureDefaultFormat() throws Exception {
        String pngFileName = "C:/testButtons2.png";
        File file = new File(pngFileName);
        if (file.exists()) {
            file.delete();
        }
        ie.windowCapture(pngFileName);
        assertTrue(file.exists());
    }

    public void testScreenCaptureBmpFormat() throws Exception {
        String bmpFileName = "C:/testButtons.bmp";
        File file = new File(bmpFileName);
        if (file.exists()) {
            file.delete();
        }
        ie.screenCapture(bmpFileName, "bmp");
        assertTrue(file.exists());
    }

    public void testWindowCaptureBmpFormat() throws Exception {
        String bmpFileName = "C:/testButtons2.bmp";
        File file = new File(bmpFileName);
        if (file.exists()) {
            file.delete();
        }
        ie.windowCapture(bmpFileName, "bmp");
        assertTrue(file.exists());
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.