Dynamically change the logging level

During the test run the console log is being produced.
I need to switch off the logging of ERRORs for a small chunk of the test case script so that whatever ERROR is encountered on those few lines it will not be written in the log.
But I still need to detect the ERROR and handle it properly, so FailureHandling.OPTIONAL is not usable here.

To tackle this problem, is it e.g. possible to change the level of the default logging in the test case script, please?

I don’t think it is possible to change log level at runtime. You can refine log level in <projectDir>/Include/config/log.properties.

Thank you, your response saves me from further attempts to figure out how to change it during run-time.

My original problem is that although all the functions waitForElement[Present|Visible|Clickable] and verifyElement[Present|Visible|Clickable] indicate the availability of the element, it sometimes happens that, immediately after the checks, invoking the click function results in the error “Unable to click on …”. Therefore, a function was written that (for a specified period of time) repeatedly directly calls the click function in a try - catch block. This occassionally produces an ERROR which is logged. This “allowed” ERROR then complicates the automatic analysis of the logs.

	@Keyword
	/**
	 * Really wait for test object to be present.
	 * Funkce waitForElement[Present|Visible|Clickable] nejsou spolehlivé. 
	 * See http://forum.katalon.com/t/really-waiting-for-element-to-load/11881/18
	 * @param testObject
	 * @param waitTime
	 * @return
	 */
	def smartWaitClickable(TestObject testObject, int waitTime){
		for (int j = 0; j <= waitTime; j++) {
			if(!(
			WebUI.verifyElementClickable(testObject, FailureHandling.OPTIONAL)
			&& WebUI.verifyElementVisible(testObject, FailureHandling.OPTIONAL)
			&& WebUI.verifyElementPresent(testObject, 5, FailureHandling.OPTIONAL))
			){
				WebUI.comment('Element ' + testObject.toString() + ' is not ready.')
				WebUI.delay(1)
				//continue
			}else{
				WebUI.comment(testObject.toString() + ' is ready')
				WebUI.waitForElementPresent(testObject, 5)
				WebUI.waitForElementVisible(testObject, 5)
				WebUI.waitForElementClickable(testObject, 5)
				WebUI.click(testObject)
				break
			}
			if(j==waitTime){
				KeywordUtil.markFailed('Element ' + testObject.toString() + ' was never found')
				break
			}
		}
	}

	@Keyword
	/**
	 * Zkouší se klikat na prvek tak dlouho, dokud se to nepovede, nebo dokud nevyprší time-out.
	 * Funkce waitForElement[Present|Visible|Clickable] nejsou spolehlivé.
	 * See http://forum.katalon.com/t/really-waiting-for-element-to-load/11881/18
	 * @param testObject
	 * @param waitTime
	 * @return
	 */
	def tryClicking(TestObject testObject, int waitTime){
		for (int j = 0; j <= waitTime; j++) {
			try {
				WebUI.waitForElementClickable(testObject, 5) 	// co kdyby tohle náhodou fungovalo... mohlo by ušetřit 1 vteřinu zdržení v catch bloku
				WebUI.click(testObject)
				WebUI.comment(testObject.toString() + ' is ready')
				break
			} catch (Exception e) {
				WebUI.comment(testObject.toString() + ' is not ready')
				WebUI.delay(1)
				continue
			}
			if(j==waitTime){
				KeywordUtil.markFailed('Element ' + testObject.toString() + ' was never clicked')
				break
			}
		}
	}

I’m just curious - in what cases are those keywords not reliable? Is there any script on your page which is able to change web elements after they are loaded? I suppose as soon as verifyElementXXX method returns true, web element (TestObject) is found and ready to use.

I’ll have to ask the developers. Thank you for the hint.