How to use if/else statements

Hi there,

Im new at automation testing and I have a question for you.

I want to use if/else statements without know any code level, for example:

1- Sometimes on page have a word like ‘KATALON’
2- If system find ‘KATALON’ word on any level, run next step.
3- If system cannot find ‘KATALON’ than click next page.

here is my script but failed everytime‘Page/div_Search’))

if (true) {

WebUI.verifyTextPresent('KATALON', false)'Page/div_KATALON'))'Page/div_Continue'))

} else {‘Page/img’))


Thank you


In which line the test fail? and what is the error message you have?

In my condition always if part executed, never goes to else and so ;when if condition fails program still search for elements in if condition and then fails obviously it wont find those elements on page -
below is my code-
String string_MatchRecords = WebUI.getText(findTestObject(‘Object Repository/Approce Application_GOAMTCH/total_records’))


	String match_record = string_MatchRecords.substring(string_MatchRecords.lastIndexOf("/")+1);
	if (match_record>1)

		WebUI.delay(2)'Object Repository/Approce Application_GOAMTCH/create_new'))'Object Repository/Approce Application_GOAMTCH/generateID_okButton'))
		WebUI.delay(3)'Object Repository/Approce Application_GOAMTCH/createAsNew_yes'))
		//'Object Repository/Approce Application_GOAMTCH/create_yes_button'))
		WebUI.delay(1)'Object Repository/Approce Application_GOAMTCH/generateID_okButton'))