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.
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:
Prevent Test suite close browser (Project -> Settings -> Execution -> Terminate driver after each test suite) Credit: Zazrshima above
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)
}
}
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