Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.255
    • Labels:
      None

      Description

      I want to get page source on step failure. For this I override method stepFailed() of BaseStepListener class (in my own class which extends BaseStepListener ).

      To get page source here I was going to use getDriver().getPageSource(). But the problem is that getDriver() returns null here.

      Debugging I see that page source could be taken from ((ThucydidesWebdriverManager) webdriverManager).getWebdriver().getPageSource(). But webdriverManager has PRIVATE access and there is no Getter for this field.

      What can I do in this situation?

      Thanks!

        Activity

        Hide
        johnsmart added a comment -

        In 0.9.255, you can use StepEventBus.getEventBus().getCurrentStep() to access the current step, which contains the latest recorded screenshots and HTML source code.

        Show
        johnsmart added a comment - In 0.9.255, you can use StepEventBus.getEventBus().getCurrentStep() to access the current step, which contains the latest recorded screenshots and HTML source code.
        Hide
        oleg.hayevskyy added a comment -

        Hi,
        I'm trying to get html page source as explained above and getting ClassCastingException.

        Here is my code snippet:
        L1 Optional<TestStep> testStep = StepEventBus.getEventBus().getCurrentStep();
        L2 Optional<File> file = testStep.get().getFirstScreenshot().getHtmlSource();

        And this is the exception that I get in Line1
        net.thucydides.core.model.TestStep cannot be cast to com.google.common.base.Optional

        Am I doing anything wrong?

        Show
        oleg.hayevskyy added a comment - Hi, I'm trying to get html page source as explained above and getting ClassCastingException. Here is my code snippet: L1 Optional<TestStep> testStep = StepEventBus.getEventBus().getCurrentStep(); L2 Optional<File> file = testStep.get().getFirstScreenshot().getHtmlSource(); And this is the exception that I get in Line1 net.thucydides.core.model.TestStep cannot be cast to com.google.common.base.Optional Am I doing anything wrong?

          People

          • Assignee:
            johnsmart
            Reporter:
            Albina_Kravchenko
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: