Search code examples
javaseleniumcucumber-jvm

Prevent to close browser after @After


I am trying to prevent browser to close after my test scenario, I have tried several things found from online resources but nothing worked so far.

The goal is to prevent the browser to get closed and keep manually from a certain point, like a 'checkpoint', is there any way to do this?

I have tried :

@After("@leave_window_open")

but seems it is working only if the Scenario is failing.

is there any simple way to block this behavior, and avoiding debugging?


Solution

  • The browser won't close unless you call .close() or .quit(). You must have those calls somewhere... just remove them. If you are looking for a intermittent fix, just add a breakpoint where you want the script to stop. Once the run breaks, stop the execution and continue manually. I do this all the time for debugging purposes.