Skip to content

WebDriver wrapper that generates GIFs during test execution

Notifications You must be signed in to change notification settings

web-innovate/gif-webdriver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gif-webdriver

Build Status codecov Maven metadata URI

add the library to your project's pom.xml file

<dependency>
    <groupId>com.github.bogdanlivadariu</groupId>
    <artifactId>gif-webdriver</artifactId>
    <version>LATEST</version>
</dependency>

sample usage

    public void sampleGifDriver() {
        // initialize the driver
        WebDriver driver = new GifWebDriver(new ChromeDriver());
        //WebDriver driver = new GifWebDriver(new FirefoxDriver());
        //WebDriver driver = new GifWebDriver(new RemoteWebDriver());

        // you can use either driver webdriver/gifdriver
        GifWebDriver gifDriver = (GifWebDriver) driver;

        // screenshots will be taken implicitly on click events
        driver.findElement(By.id("someIDon a page")).click();

        // on quit the driver will generate the gifs
        driver.quit();

        // if you want to control when gifs are generated you can do it through the API
        File createdGif = gifDriver.getGifScreenshotWorker().createGif();

        //of course you can create screenshots explicitly
        gifDriver.getGifScreenshotWorker().takeScreenshot();

        // if you don't know where the screenshots are taken or where the gifs are created
        String rootFolder = gifDriver.getGifScreenshotWorker().getRootDir();

        // more options about where the gifs are created can be accomplished by using these methods
        GifScreenshotWorker gifWorker = gifDriver.getGifScreenshotWorker();
        gifWorker.setTimeBetweenFramesInMilliseconds(1000);
        gifWorker.setRootDir("some place where files screenshots and gifs will be placed");
        gifWorker.setLoopContinuously(true);

        // these properties can be set during initialization as well
        GifScreenshotWorker myPreciousWorker = new GifScreenshotWorker(
            new ChromeDriver(),
            "rootDir",
            "screenshots folder name",
            "generatedGifs folder name",
            true
        );

        WebDriver myPreciousDriver = new GifWebDriver(new ChromeDriver(), myPreciousWorker);
        // and from here it's pretty much all the same
    }

About

WebDriver wrapper that generates GIFs during test execution

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages