Giter VIP home page Giter VIP logo

gif-webdriver's Introduction

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
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.