seleniumgroovywebdriverspockgeb

WebDriver not auto clearing after Geb + Spock specs


When running multiple tests the driver was not auto clearing for a clean slate with new specs. How can I implement this functionality to clean the driver after each spec?


Solution

  • I noticed a lot of questions for this problem but no one seems to point to a very easy built in solution.

    Just put autoClearWebStorage = true in the GebConfig.groovy file. That is it!

    Link to documentation explaining how this is off by default here

    Certain integrations will automatically clear the driver’s web storage, that is both local and session storage, which is usually necessary when using an implicit driver. This configuration flag, which is false by default, can be enabled by setting the autoClearWebStorage value in the config to true.

    autoClearWebStorage = true