@AfterMethod
    public void takeScreenshot(ITestResult result) {
        if (result.getStatus() == ITestResult.FAILURE) {
            if (driver != null) {
                String pageName = driver.getTitle();
                Log4Test.info("Taking screenshot for: " + pageName);
                ScreenshotMaker screenshotMaker = new ScreenshotMaker(driver);
                screenshotMaker.takeScreenShot(pageName);
            }
        }
    }