Test suite with 2 test cases fail with "Session is Null" Error

hi,

I am trying to execute test suite with 2 test cases. When individually these tests are executed it works fine as expected (as test case and only one test from suite both works).

However, when i execute the suite with both the tests enabled, the first test works and the second one fails with “Session ID is NULL” error.

I have used custom keyword with respect to my application.
Below is the console logs.

2020-02-04 17:26:15.311 INFO  c.k.katalon.core.main.TestSuiteExecutor  - START Test Suites/AEM_UI_Author_Test_Suite/AEM-Author-Suite
2020-02-04 17:26:15.371 INFO  c.k.katalon.core.main.TestSuiteExecutor  - hostName = somename
2020-02-04 17:26:15.372 INFO  c.k.katalon.core.main.TestSuiteExecutor  - os = Windows 10 64bit
2020-02-04 17:26:15.374 INFO  c.k.katalon.core.main.TestSuiteExecutor  - hostAddress = someaddress
2020-02-04 17:26:15.377 INFO  c.k.katalon.core.main.TestSuiteExecutor  - katalonVersion = 6.3.0.1
2020-02-04 17:26:15.693 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2020-02-04 17:26:15.693 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/SearchAssetsTestCase
2020-02-04 17:26:16.163 DEBUG testcase.SearchAssetsTestCase            - 1: openBrowser("")
2020-02-04 17:26:16.594 INFO  c.k.k.core.webui.driver.DriverFactory    - Starting 'Chrome' driver
Feb 04, 2020 5:26:16 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
2020-02-04 17:26:16.636 INFO  c.k.k.core.webui.driver.DriverFactory    - Action delay is set to 0 seconds
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 15361
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Feb 04, 2020 5:26:20 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2020-02-04 17:26:20.298 INFO  c.k.k.core.webui.driver.DriverFactory    - sessionId = 497d53a0e54725877cc5e2ba0e4c6a31
2020-02-04 17:26:20.322 INFO  c.k.k.core.webui.driver.DriverFactory    - browser = Chrome 79.0.3945.130
2020-02-04 17:26:20.323 INFO  c.k.k.core.webui.driver.DriverFactory    - platform = Windows 10
2020-02-04 17:26:20.323 INFO  c.k.k.core.webui.driver.DriverFactory    - seleniumVersion = 3.141.59
2020-02-04 17:26:20.325 INFO  c.k.k.core.webui.driver.DriverFactory    - proxyInformation = ProxyInformation{proxyOption=NO_PROXY, proxyServerType=HTTP, password=, proxyServerAddress=, proxyServerPort=0}
2020-02-04 17:26:20.326 DEBUG testcase.SearchAssetsTestCase            - 2: navigateToUrl("http://localhost:4502/libs/granite/core/content/login.html?resource=%2F&$$login$$=%24%24login%24%24&j_reason=unknown&j_reason_code=unknown")
2020-02-04 17:26:21.297 DEBUG testcase.SearchAssetsTestCase            - 3: setText(findTestObject("Object Repository/Page_AEM Sign In/input_Learn More_j_username"), "admin")
2020-02-04 17:26:21.595 DEBUG testcase.SearchAssetsTestCase            - 4: setEncryptedText(findTestObject("Object Repository/Page_AEM Sign In/input_Learn More_j_password"), "RAIVpflpDOg=")
2020-02-04 17:26:21.827 DEBUG testcase.SearchAssetsTestCase            - 5: click(findTestObject("Object Repository/Page_AEM Sign In/coral-button-label_Sign In"))
2020-02-04 17:26:22.514 DEBUG testcase.SearchAssetsTestCase            - 6: navigateToUrl("http://localhost:4502/assets.html/content/dam")
2020-02-04 17:26:23.553 DEBUG testcase.SearchAssetsTestCase            - 7: aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.searchContent("/content/dam/we-retail/", "skitouring")
in constructor CChromeDriver: chrome on WINDOWS (497d53a0e54725877cc5e2ba0e4c6a31)
2020-02-04 17:26:23.665 INFO  com.kms.katalon.core.util.KeywordUtil    - Inside BaseUtilityPOJO Constructor 
2020-02-04 17:26:23.780 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : commonFunction : com.commonFunctions.CommonFunction@14379273
2020-02-04 17:26:23.793 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : locatorFactory : com.locatorFactory.LocatorFactory@2257fadf
2020-02-04 17:26:23.803 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : waitFactory : com.waitFactory.WaitFactory@35835e65
in constructor exit CChromeDriver: chrome on WINDOWS (497d53a0e54725877cc5e2ba0e4c6a31)
in constructor CChromeDriver: chrome on WINDOWS (497d53a0e54725877cc5e2ba0e4c6a31)
2020-02-04 17:26:23.909 INFO  com.kms.katalon.core.util.KeywordUtil    - Inside BaseUtilityPOJO Constructor 
2020-02-04 17:26:23.909 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : commonFunction : com.commonFunctions.CommonFunction@2b61a019
2020-02-04 17:26:23.910 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : locatorFactory : com.locatorFactory.LocatorFactory@11a00961
2020-02-04 17:26:23.911 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : waitFactory : com.waitFactory.WaitFactory@7ce9e05a
in constructor exit CChromeDriver: chrome on WINDOWS (497d53a0e54725877cc5e2ba0e4c6a31)
in search method CChromeDriver: chrome on WINDOWS (497d53a0e54725877cc5e2ba0e4c6a31)
in search method 1 toggle button
in search method 2 filter button
in search method 3 clear text
in search method 4 enter path
in search method 5 enter
in search method 6 enter content path
in search method 7 enter ch
2020-02-04 17:27:00.170 ERROR com.kms.katalon.core.util.KeywordUtil    - ❌ Wait condition failed. java.lang.Exception: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.cssSelector: *[id$='result-empty'] (tried for 30 second(s) with 0 milliseconds interval)
2020-02-04 17:27:00.171 INFO  k.k.c.m.CustomKeywordDelegatingMetaClass - aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.searchContent is PASSED
2020-02-04 17:27:00.173 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/SearchAssetsTestCase
2020-02-04 17:27:00.181 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2020-02-04 17:27:00.181 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/SearchSiteTestCase
2020-02-04 17:27:00.283 DEBUG testcase.SearchSiteTestCase              - 1: openBrowser("")
2020-02-04 17:27:00.288 WARN  c.k.k.core.webui.driver.DriverFactory    - A browser is already opened. Closing browser and opening a new one
2020-02-04 17:27:01.082 INFO  c.k.k.core.webui.driver.DriverFactory    - Starting 'Chrome' driver
Feb 04, 2020 5:27:01 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 41403
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Feb 04, 2020 5:27:03 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2020-02-04 17:27:03.560 INFO  c.k.k.core.webui.driver.DriverFactory    - sessionId = c74d9d3112624465625ac6bad0d778db
2020-02-04 17:27:03.572 INFO  c.k.k.core.webui.driver.DriverFactory    - browser = Chrome 79.0.3945.130
2020-02-04 17:27:03.572 INFO  c.k.k.core.webui.driver.DriverFactory    - platform = Windows 10
2020-02-04 17:27:03.573 INFO  c.k.k.core.webui.driver.DriverFactory    - seleniumVersion = 3.141.59
2020-02-04 17:27:03.574 INFO  c.k.k.core.webui.driver.DriverFactory    - proxyInformation = ProxyInformation{proxyOption=NO_PROXY, proxyServerType=HTTP, password=, proxyServerAddress=, proxyServerPort=0}
2020-02-04 17:27:03.576 DEBUG testcase.SearchSiteTestCase              - 2: navigateToUrl("http://localhost:4502/libs/granite/core/content/login.html?resource=%2F&$$login$$=%24%24login%24%24&j_reason=unknown&j_reason_code=unknown")
2020-02-04 17:27:04.465 DEBUG testcase.SearchSiteTestCase              - 3: setText(findTestObject("Object Repository/Page_AEM Sign In/input_Learn More_j_username"), "admin")
2020-02-04 17:27:04.677 DEBUG testcase.SearchSiteTestCase              - 4: setEncryptedText(findTestObject("Object Repository/Page_AEM Sign In/input_Learn More_j_password"), "RAIVpflpDOg=")
2020-02-04 17:27:04.857 DEBUG testcase.SearchSiteTestCase              - 5: click(findTestObject("Object Repository/Page_AEM Sign In/coral-button-label_Sign In"))
2020-02-04 17:27:05.532 DEBUG testcase.SearchSiteTestCase              - 6: navigateToUrl("http://localhost:4502/sites.html/content/we-retail")
2020-02-04 17:27:06.295 DEBUG testcase.SearchSiteTestCase              - 7: aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.searchContent("/content/we-retail/ca/en/experience", "skitouring")
in constructor CChromeDriver: chrome on WINDOWS (c74d9d3112624465625ac6bad0d778db)
2020-02-04 17:27:06.298 INFO  com.kms.katalon.core.util.KeywordUtil    - Inside BaseUtilityPOJO Constructor 
2020-02-04 17:27:06.299 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : commonFunction : com.commonFunctions.CommonFunction@1ab37c94
2020-02-04 17:27:06.299 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : locatorFactory : com.locatorFactory.LocatorFactory@6b03325d
2020-02-04 17:27:06.300 INFO  com.kms.katalon.core.util.KeywordUtil    - startCommonFunctions : waitFactory : com.waitFactory.WaitFactory@4ba5c0f0
in constructor exit CChromeDriver: chrome on WINDOWS (c74d9d3112624465625ac6bad0d778db)
in search method CChromeDriver: chrome on WINDOWS (c74d9d3112624465625ac6bad0d778db)
2020-02-04 17:27:06.652 ERROR com.kms.katalon.core.util.KeywordUtil    - ❌ java.lang.Exception: java.lang.Exception: java.lang.Exception: java.lang.Exception: org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'MKARTHIK-WX-3', ip: '10.192.227.235', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: RemoteWebDriver
2020-02-04 17:27:06.671 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/SearchSiteTestCase
2020-02-04 17:27:06.654 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - ❌ com.kms.katalon.core.exception.StepErrorException: Unable to search for content : skitouring in path : /content/we-retail/ca/en/experience
2020-02-04 17:27:06.668 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/SearchSiteTestCase FAILED.
Reason:
com.kms.katalon.core.exception.StepErrorException: Unable to search for content : skitouring in path : /content/we-retail/ca/en/experience
	at com.kms.katalon.core.util.KeywordUtil.markError(KeywordUtil.java:65)
	at com.kms.katalon.core.util.KeywordUtil$markError$0.call(Unknown Source)
	at aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.searchContent(SearchContent.groovy:69)
	at aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.invokeMethod(SearchContent.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at SearchSiteTestCase.run(SearchSiteTestCase:17)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:150)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:123)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:87)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1580817372589.run(TempTestSuite1580817372589.groovy:35)

2020-02-04 17:27:07.594 INFO  c.k.katalon.core.main.TestSuiteExecutor  - --------------------
2020-02-04 17:27:07.594 INFO  c.k.katalon.core.main.TestSuiteExecutor  - END Test Suites/AEM_UI_Author_Test_Suite/AEM-Author-Suite
2020-02-04 17:27:07.594 INFO  c.k.katalon.core.main.TestSuiteExecutor  - ====================

Below is my test suite:

Below are 2 tests:

Test 1:

WebUI.openBrowser('')

WebUI.navigateToUrl('http://localhost:4502/libs/granite/core/content/login.html?resource=%2F&$$login$$=%24%24login%24%24&j_reason=unknown&j_reason_code=unknown')

WebUI.setText(findTestObject('Object Repository/Page_AEM Sign In/input_Learn More_j_username'), 'admin')

WebUI.setEncryptedText(findTestObject('Object Repository/Page_AEM Sign In/input_Learn More_j_password'), 'RAIVpflpDOg=')

WebUI.click(findTestObject('Object Repository/Page_AEM Sign In/coral-button-label_Sign In'))

WebUI.navigateToUrl('http://localhost:4502/sites.html/content/we-retail')

CustomKeywords.'aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.searchContent'('/content/we-retail/ca/en/experience', 
    'skitouring')

Test 2 :

WebUI.openBrowser('')

WebUI.navigateToUrl('http://localhost:4502/libs/granite/core/content/login.html?resource=%2F&$$login$$=%24%24login%24%24&j_reason=unknown&j_reason_code=unknown')

WebUI.setText(findTestObject('Object Repository/Page_AEM Sign In/input_Learn More_j_username'), 'admin')

WebUI.setEncryptedText(findTestObject('Object Repository/Page_AEM Sign In/input_Learn More_j_password'), 'RAIVpflpDOg=')

WebUI.click(findTestObject('Object Repository/Page_AEM Sign In/coral-button-label_Sign In'))

WebUI.navigateToUrl('http://localhost:4502/assets.html/content/dam')

CustomKeywords.'aemUtils.aemAuthorUtils.aemAuthorGeneric.aemSearchContent.SearchContent.searchContent'('/content/dam/we-retail/', 
    'skitouring')

Below is my custom keyword:

    public class SearchContent {
	 BaseUtilityPOJO baseUtilityPOJO
	 CommonFunctionsKeyWords commonFunctionsKeyWords

	SearchContent() {
		if(baseUtilityPOJO==null && commonFunctionsKeyWords==null) {
			baseUtilityPOJO=new BaseUtilityPOJO()
			commonFunctionsKeyWords=new CommonFunctionsKeyWords()
		}
	}

	/**
	 * This method is used to perform search action in AEM author
	 * @param pathTobeSearched : path of the content to be searched
	 * @param contentValueToBeSearched : value to be searched
	 * @return
	 */
	@Keyword
	public boolean searchContent(String pathTobeSearched,String contentValueToBeSearched) {
		boolean searchAction=false
		try{
			println ("in search method "+DriverFactory.getWebDriver())
			baseUtilityPOJO.getCommonFunction().clickOnElement(WebUiCommonHelper.findWebElement(findTestObject('Object Repository/Page_AEM Sites/ToggleButton'),baseUtilityPOJO.timeOut))
			println ("in search method 1 toggle button")
			baseUtilityPOJO.getCommonFunction().clickOnElement(WebUiCommonHelper.findWebElement(findTestObject('Object Repository/Page_AEM Sites/filterOption'),baseUtilityPOJO.timeOut))
			println ("in search method 2 filter button")
			commonFunctionsKeyWords.clearTextField(WebUiCommonHelper.buildLocator(findTestObject('Page_AEM Search/pathTextField')))
			println ("in search method 3 clear text")
			baseUtilityPOJO.getCommonFunction().enterText(WebUiCommonHelper.findWebElement(findTestObject('Page_AEM Search/pathTextField'),baseUtilityPOJO.timeOut),pathTobeSearched)
			println ("in search method 4 enter path")
			baseUtilityPOJO.getCommonFunction().enterText(WebUiCommonHelper.findWebElement(findTestObject('Page_AEM Search/pathTextField'),baseUtilityPOJO.timeOut), Keys.chord(Keys.ENTER))
			println ("in search method 5 enter")
			baseUtilityPOJO.getCommonFunction().enterText(WebUiCommonHelper.findWebElement(findTestObject('Page_AEM Search/searchTextField'),baseUtilityPOJO.timeOut), contentValueToBeSearched)
			println ("in search method 6 enter content path")
			baseUtilityPOJO.getCommonFunction().enterText(WebUiCommonHelper.findWebElement(findTestObject('Page_AEM Search/searchTextField'),baseUtilityPOJO.timeOut), Keys.chord(Keys.ENTER))
			println ("in search method 7 enter ch")
			boolean sucessfullCondition
			boolean noResultCondition
			try{
				waitForResultToBeDisplayed(sucessfullCondition, noResultCondition)
			}
			catch(Exception e) {
				KeywordUtil.logger.logError("Wait condition failed. "+e.getMessage())
			}
			if((sucessfullCondition)||(noResultCondition)) {
				KeywordUtil.markPassed("Search action completed")
				searchAction=true
			}
		}
		catch(Exception e) {
			KeywordUtil.markError("Unable to search for content : "+contentValueToBeSearched+" in path : "+pathTobeSearched)
			KeywordUtil.logger.logError(e.getMessage())
		}
		return searchAction
	}

	/**
	 * This method is used to wait for the search action to complete
	 * @param sucessfullCondition : true/false if searched assets are displayed
	 * @param noResultCondition : true/false if searched no result is displayed
	 */
	private waitForResultToBeDisplayed(boolean sucessfullCondition, boolean noResultCondition) {
		sucessfullCondition= baseUtilityPOJO.getWaitFactory().numberOfElementsToBeMoreThan(WebUiCommonHelper.buildLocator(findTestObject('Page_AEM Search/searchResult')),0)
		noResultCondition= baseUtilityPOJO.getWaitFactory().presenceOfElementLocated(WebUiCommonHelper.buildLocator(findTestObject('Page_AEM Search/emptySearchResult')))
	}

Below are supporting classes.

public class BaseUtilityPOJO {
	private CommonFunction commonFunction
	private WaitFactory waitFactory
	private LocatorFactory locatorFactory
	private static WebDriver driver
	private PropertyReader propReader
	private Long timeOutValue
	private Long pollTime
	private int timeOut
	private int pollTimeValue

	/**
	 * This constructor is responsible for instantiating the variables for {WaitFactory, CommonFunction, LocatorFactory}
	 */	


	BaseUtilityPOJO(){
		println ("in constructor "+DriverFactory.getWebDriver())
		try{
			propReader = new PropertyReader()
			timeOutValue=Long.parseLong(propReader.getPropertyValueFromFile(System.getProperty("user.dir")+"\\Include\\config\\globalConfig.properties", "timeOutInseconds"))
			pollTime=Long.parseLong(propReader.getPropertyValueFromFile(System.getProperty("user.dir")+"\\Include\\config\\globalConfig.properties", "pollTimeOutInseconds"))
			timeOut=(int)timeOutValue
			pollTime=(int)pollTimeValue
			initialzeDriver()
			KeywordUtil.logInfo("Inside BaseUtilityPOJO Constructor ")
		}
		catch(BrowserNotOpenedException e) {
			KeywordUtil.logInfo("Browser not started. Will be starting a new session now")
			String browser=DriverFactory.getExecutedBrowser().getName()
			KeywordUtil.logInfo("Browser started is : "+browser)
			WebUI.openBrowser('')
			initialzeDriver()
		}
		commonFunction = new CommonFunction(driver,timeOutValue , pollTime)
		KeywordUtil.logInfo("startCommonFunctions : commonFunction : " + commonFunction)
		locatorFactory = new LocatorFactory(driver)
		KeywordUtil.logInfo("startCommonFunctions : locatorFactory : " + locatorFactory)
		waitFactory = new WaitFactory(driver,timeOutValue,pollTime)
		KeywordUtil.logInfo("startCommonFunctions : waitFactory : " + waitFactory)
		println ("in constructor exit "+DriverFactory.getWebDriver())
	}

	@Keyword
	public void initialzeDriver() {
		driver=DriverFactory.getWebDriver()
	}
	/**
	 * getters to get Driver instance 
	 */
	public WebDriver getDriver() {
		return driver
	}
	/**
	 * getters to get waitFactory instance 
	 */
	public WaitFactory getWaitFactory() {
		return this.waitFactory
	}
	/**
	 * getters to get commonFunction instance 
	 */
	public CommonFunction getCommonFunction() {
		return this.commonFunction
	}
	/**
	 * getters to get locatorFactory instance 
	 */
	public LocatorFactory getLocatoryFactory() {
		return this.locatorFactory
	}
}

public class CommonFunctionsKeyWords {
	static BaseUtilityPOJO baseUtilityObj
	public static CommonFunction commonFunction
	public static WaitFactory waitFactory
	public static LocatorFactory locatorFactory
	public WebElement element;
	public List<WebElement> elements;

	CommonFunctionsKeyWords() {
		try{
			if(baseUtilityObj==null) {
				baseUtilityObj = new BaseUtilityPOJO()
				this.commonFunction = baseUtilityObj.getCommonFunction()
				this.waitFactory = baseUtilityObj.getWaitFactory()
				this.locatorFactory = baseUtilityObj.getLocatoryFactory()
			}
		}
		catch(Exception e) {
			KeywordUtil.logger.logError("Failed to initialze in CommonfunctionsKeyword class")
			KeywordUtil.logger.logError(e.getMessage())
		}
	}
	/**
	 * This method is used to clear text on the text filed
	 * @param object : By/WebElement for clearing the text
	 */
	@Keyword
	public void clearTextField(Object object) {
		try{
			baseUtilityObj.getWaitFactory().visibilityOf(object)
			if(object instanceof By) {
				baseUtilityObj.getLocatoryFactory().findElement(object).clear()
			}
			else if(object instanceof WebElement) {
				object.clear()
			}
			else{
				throw new CommonFunctionException("Invalid type sent. Expected By/WebElement")
			}
		}
		catch(Exception e) {
			KeywordUtil.logger.logError("Unable to clear text in text field")
			KeywordUtil.logger.logError(e.getMessage())
		}
	}

Please suggest what needs to be done.

Thanks and regards,
Karthik

I’m just guessing here – are you closing the browser after each test case? Either in code somewhere or…

image

You have WebUI.openBrowser('') in both of Test1 and Test2, and you do not have WebUI.closeBrowser(). It looks strange.

Why not you close browsers at the end of each test cases?

I do not have set the configuration to close browser after each test case

Also, i do not see any code related to closing the browser

Earlier i had close web method called as last step in each of my test case. But i thought that could be the issue so have removed the close method call. With or without close i am observing the same behavior

I found the following message in the log you posted. Possibly this is the real cause of your problem.

1 Like

In addition to what @kazurayam said, you’re claiming to see one error "Session is null" but showing us another, different error, "Wait condition failed".

And the reason Kazuraym said “it looks strange” is because when running a suite, it’s normal practice to close the browser between each Test Case. Even the output is telling you that:

That is just a wait condition to validate the search action. I am just waiting for 2 wait condition. One positive and one negative. So if even one condition is true I would consider as search action complete. So that would not be cause of error.

So the timeout exception is just the failure of wait condition for the result it did not get. But since it is in try catch block it should continue. I have tested the positive and negative wait and it is expected to see the error message of time out in the logs.

Also, I had added close browser in both of my tests but still it resulted in the same issue

Something similar was reported earlier.

You have this:

Why do you need static? In my experience, unnecessary static modifier tends to cause unpredictable behaviour. How about changing this to:

public class BaseUtilityPOJO { 
    ....
    private WebDriver driver
    ....

Removing static may cause some compilation errors. That would indicate to you where you should improve (simplify?) your codes.

1 Like

Consider performing your browser open and close within the SetUp and TearDown methods of your Test Suite rather than within each Test Case.

/**
 * Setup test suite environment.
 */
@SetUp(skipped = false) // Please change skipped to be false to activate this method.
def setUp() {
	WebUI.openBrowser(null)
}

/**
 * Clean test suites environment.
 */
@TearDown(skipped = false) // Please change skipped to be false to activate this method.
def tearDown() {
	WebUI.closeBrowser()
}