NullPointerException
Hello Conny, I'm trying to run your code and getting NPE. I think some major initiation step is missing in your readme file. You are creating a new TakeScreenshotRule object: @Rule public TakesScreenshotRule screenshot = new TakesScreenshotRule(); ...and then call it's takeScreenshot(driver) method which in turn calls: public ScreenshotMeta takeScreenshot(String id, WebDriver driver) throws IOException { return this.screenshotManager.takeScreenshot(driver, id); }
BUT screenshotManager is not initialized at this point and that is why I get NPE (screenshotManager = NULL). screenshotManager is initialized in: public Statement apply(Statement base, FrameworkMethod method, Object target) { this.screenshotManager = new ScreenshotManager(target.getClass(), method.getName()); return base; } ....but this method is not called from anywhere.
Could you please provide a bit more details on how to make this code work?
Thank you in advance, Michael
Sorry for the late reply.
Do you run your test with a junit 4 runner? @Rule is a junit 4 annotation!