JBehave
  1. JBehave
  2. JBEHAVE-864

Take screenshot before ending WebDriver

    Details

    • Type: Wish Wish
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.x
    • Fix Version/s: None
    • Component/s: Web Selenium
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Hello !

      I'm using JBehave + Selenium for some weeks now, my goal is to create a ease of use project for some people in my firm.

      I have set up a way the take a screenshot of last webpage before Firefox ends. I extended from FirefoxWebDriverProvider and override end() method.

      Is there a way to get it part of the JBehave-Selenium Framework ?

      Thanks !

        Activity

        Hide
        Mauro Talevi added a comment -

        The way JBehave allows snapshots is via the @Before/@After annotations, e.g. in the WebDriverScreenshotOnFailure steps class which can be configured by the user.

        We could add another WebDriverScreenshotOnEnd but the problem is that there is no obvious way to inject the name of the path to write the screenshot to. In the case of a failure it's the exception UUID.

        If you have a solution you want to share, we'd be happy to consider it.

        Show
        Mauro Talevi added a comment - The way JBehave allows snapshots is via the @Before/@After annotations, e.g. in the WebDriverScreenshotOnFailure steps class which can be configured by the user. We could add another WebDriverScreenshotOnEnd but the problem is that there is no obvious way to inject the name of the path to write the screenshot to. In the case of a failure it's the exception UUID. If you have a solution you want to share, we'd be happy to consider it.
        Hide
        Damien LG added a comment -

        I tried to do that with @AfterStories but Firefox was already ended.

        For what I've done so far to get it working, override the end() method with this :

        saveScreenshotTo(new StoryReporterBuilder().outputDirectory()+"/screenshots/final.png");
        super.end();

        Then I have a custom HtmlOutput extended from HtmlOutput with new pattern :

        overwritePattern("afterStory", "<div class=\"scenario\"><h2>Last screenshot</h2><div><a color=\"black\" target=\"jb_scn_shot\" href=\"../screenshots/final.png\"><img src=\"images/final_screenshot.png\" alt=\"final screenshot\"/></a></div></div></div>\n");

        Show
        Damien LG added a comment - I tried to do that with @AfterStories but Firefox was already ended. For what I've done so far to get it working, override the end() method with this : saveScreenshotTo(new StoryReporterBuilder().outputDirectory()+"/screenshots/final.png"); super.end(); Then I have a custom HtmlOutput extended from HtmlOutput with new pattern : overwritePattern("afterStory", "<div class=\"scenario\"><h2>Last screenshot</h2><div><a color=\"black\" target=\"jb_scn_shot\" href=\"../screenshots/final.png\"><img src=\"images/final_screenshot.png\" alt=\"final screenshot\"/></a></div></div></div>\n");
        Hide
        Roy de Kleijn added a comment -

        We have similar issues when using multiple threads and http://jaroslav-sedlacek.blogspot.nl/2011/05/screenshots-in-jbehave-reports.html

        end() is called before AfterScenario in WebDriverScreenshotOnFailure

        I'm using version 3.7.5

        Show
        Roy de Kleijn added a comment - We have similar issues when using multiple threads and http://jaroslav-sedlacek.blogspot.nl/2011/05/screenshots-in-jbehave-reports.html end() is called before AfterScenario in WebDriverScreenshotOnFailure I'm using version 3.7.5

          People

          • Assignee:
            Unassigned
            Reporter:
            Damien LG
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: