Skip to content
This repository was archived by the owner on Aug 24, 2023. It is now read-only.
This repository was archived by the owner on Aug 24, 2023. It is now read-only.

NullPointerException #1

@Mihalavr

Description

@Mihalavr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions