publicvoidsampleGifDriver() {
// initialize the driverWebDriverdriver = newGifWebDriver(newChromeDriver());
//WebDriver driver = new GifWebDriver(new FirefoxDriver());//WebDriver driver = new GifWebDriver(new RemoteWebDriver());// you can use either driver webdriver/gifdriverGifWebDrivergifDriver = (GifWebDriver) driver;
// screenshots will be taken implicitly on click eventsdriver.findElement(By.id("someIDon a page")).click();
// on quit the driver will generate the gifsdriver.quit();
// if you want to control when gifs are generated you can do it through the APIFilecreatedGif = gifDriver.getGifScreenshotWorker().createGif();
//of course you can create screenshots explicitlygifDriver.getGifScreenshotWorker().takeScreenshot();
// if you don't know where the screenshots are taken or where the gifs are createdStringrootFolder = gifDriver.getGifScreenshotWorker().getRootDir();
// more options about where the gifs are created can be accomplished by using these methodsGifScreenshotWorkergifWorker = 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 wellGifScreenshotWorkermyPreciousWorker = newGifScreenshotWorker(
newChromeDriver(),
"rootDir",
"screenshots folder name",
"generatedGifs folder name",
true
);
WebDrivermyPreciousDriver = newGifWebDriver(newChromeDriver(), myPreciousWorker);
// and from here it's pretty much all the same
}