How to prevent from browser closing in test suite

Hello,

when running a test suite, when a test case is completed, the browser is closing for the next test case to go on.

There is not any “close browser” action in any of my test cases.

Does anybody can help in order to prevent the browser from closing so I can compare the results of each test cases at the end ?

Hello Vinh,

the option is unchecked and when I am executing a test suite, the browser is closing before the next test starts.

This option works only when I have 1 test case in my test suite. When there are more than 1 test case, it behaves as described above.

Do you confirm this behaviour of this is an error in the option ?

Thank you for your help.

1 Like

Please check for me if you’ve turned on the option ‘Terminate drivers’ from "Preferences -> Katalon -> Execution". If so please uncheck it

1 Like

I’m having the same issue with Windows_64-5.2.01. The Execution option is removed in this version.

1 Like

even I am facing same issue when i run through command line

I have found out, that if in your next test case is Open Browser command, previous browser will be closed. When deleting that line, current browser stays opened and next test case is executed.

2 Likes

My use case is: 5 test cases. All need to execute in separate Chrome browser. All need to not close after the script is finished, because last screen need human review.

My solution is as follows:

  1. Prevent Test suite close browser (Project -> Settings -> Execution -> Terminate driver after each test suite)
    Credit: Zazrshima above
  2. Add a new Test Listener
    import com.kms.katalon.core.webui.driver.DriverFactory
    import org.openqa.selenium.WebDriver
    import org.openqa.selenium.chrome.ChromeDriver

    class NewTestListener {

      @BeforeTestCase
      def sampleBeforeTestCase(TestCaseContext testCaseContext) {
        // Remember to replace your own Chrome Driver location
        System.setProperty("webdriver.chrome.driver", "C:\\SomeWhereInYourDrive\\Katalon_Studio_Windows_64\\configuration\\resources\\drivers\\chromedriver_win32\\chromedriver.exe")

        WebDriver driver1 = new ChromeDriver()
        DriverFactory.changeWebDriver(driver1)
      }
    }

Credit: Automate two different sites as part of the same test

  1. Remove all the WebUI.openBrowser('') from all your scripts.

  2. Add your test cases to the same test suit and execute

  3. You should see your test case being executed in different Chrome browser

See if this is useful to anybody, thanks.

Good !!

You know that I perform all the steps described by you, but the login does not want me to open the browser, paste the same in the two test cases at the beginning and in the test suite in the variables section.

Could you guide me, maybe I was wrong about something

class NewTestListener {

@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
// Remember to replace your own Chrome Driver location
System.setProperty(“webdriver.chrome.driver”, “C:\Users\Memory\Downloads\Katalon_Studio_Windows_64-7.7.2\configuration\resources\drivers\chromedriver_win32\chromedriver_win32\chromedriver.exe”)

WebDriver driver1 = new ChromeDriver()
DriverFactory.changeWebDriver(driver1)

}
}

I see that you use C:\Users\Memory\Downloads\ instead of C:\\Users\\Memory\\Downloads\\, please change it to \\ and see if it works.

Also, you should see in your log whether this test listener works or not, if it don’t work the test case can still run but you will see red icon in your log. Cheers