Browser instance is closed even when browser closing statements are commented


#1

Reporting against webtestit 0.6.0

Use case :
As a user I should be able to see browser windows when there is an error or test failure.

Following was commented in TestNGTestBase.java to ensure browser instance is not closed at the end of the test.

@AfterMethod
public void tearDownWebDriver() {
//driver.quit();
}

@AfterSuite(alwaysRun = true)
public void tearDown() {
//WebDriverPool.DEFAULT.dismissAll();
}

Browser was closed.


#2

Hi @janesh

you’ve exactly found the place where to stop browser quitting/closing. We’ve kept this code on purpose for the following reasons:

  • In case of a success, the browsers needs to be closed anyway
  • In case of an error, the report will tell you about the issue and the user can by hand control the closing (like you did with commenting out)
  • In case of executing via the CLI on a CI environment it would introduce a lot of troubles with keeping unclosed instances of the browser around.

So this goes pretty much into the best-practice direction, but of course as all best-practices, doesn’t account for 100% of the use-cases.


#3

Hi @vsoftic
Thanks for the detailed reply. It is really helpful

Why did the browsers were closed even when I have commented out the code as in my post?

Thanks


#4

Sorry I haven’t fully thought through your example.

you’re right … we do force kill all open child_processes after each run, so that in turn is going to kill the browser instances as well. As mentioned most of the time with Selenium in my experience it is the issue that unmaintained zombie browser instances are left, but you’re right this pretty much prevents your use-case.

We’ll need to think about this a bit more and will come back with how to approach this. Thanks again for reporting


#5

@vsoftic
Thank you. Appreciated.


#6

Meanwhile the introduced Diagnostics mode handles this case as it keeps the browser open


closed #7