Search code examples
seleniumselenium-webdrivergeb

If an assertion fails in a Geb test, how to keep the browser window open?


If a Geb test fails, it would be nice to inspect the page with a browser's developer tools. Is it possible to configure Geb in a way, that it stops on failure but keep the browser window open?


Solution

  • From http://www.gebish.org/manual/current/configuration.html:

    7.2.3 Driver Caching

    ...

    Also, by default Geb will register a shutdown hook to quit any cached browsers when the JVM exits. You can disable this by setting te config property quitCachedDriverOnShutdown to false.

    I so tried set do that in GebConfig.groovy:

    quitCachedDriverOnShutdown = false
    

    And that keeps the browser open even after all tests are finished or one has failed.