Does katalon studio have the same command as storeelementpresent in katalon recoder?

Does katalon studio have the same command as storeelementpresent in katalon recoder?

I don’t think you need such a command as you can create a variable, or Global Variable, to store the contents of some element. As an example, (in the Script pane)

def upperLimit = rows_table.size();   // this will be an integer (number)

def displayMessage = WebUI.getText(findTestObject('myPage/li_LastUpdatedTimeStamp'))  // a string

def myDate = WebUI.getAttribute(findTestObject('myPage/input_Birthdate'), 'value')  // also a string

You can test if a command is “legal” by starting a statement with “WebUI.”, or “Mobile.” (ending with a period) and then a pop-up should appear of legal commands or what Intelli-sense thinks you are trying to type in. You can also type the full command and if the command is underlined, or not in italics, then it is not a “legal” command.

If you are working in the Manual pane, then set up similar to below:

Here is a list of WebUI keywords:

I didn’t read it too well, I didn’t understand

What KR’s storeElementPresent command does?


storeElementPresent(locator, variableName)
Generated from isElementPresent(locator)
Arguments :
locator - an element locator . Returns: true if the element is present, false otherwise

Katalon Studio’s WebUI.verifyElementPresent keyword is similar to Katalon Recorders storeElementPresent command.

The following code as a Test Case in Katalon Studio does what you possibly want to see.

import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

String xpath = "//*[@id='btn-make-appointment']"
TestObject tObj = new TestObject(xpath).addProperty("xpath",ConditionType.EQUALS,xpath)
String url = ""


boolean presence = WebUI.verifyElementPresent(tObj, 10, FailureHandling.OPTIONAL)

WebUI.comment("element ${xpath} is present: ${presence}")

Please note that FailureHandling.OPTIONAL is necessary as the 3rd argument to the keyword. Otherwise the keyword will throw Exception when the targeted HTML element is found missing.

When I ran it, it showed:

2021-07-16 18:35:24.553 DEBUG t.storeElementPresent_equivalent_demo    - 7: comment(element $xpath is present: $present)
element //*[@id='btn-make-appointment'] is present: true

The script above looks in Manual mode as follows:

I tried to do as you wrote, but the result is the same

Please read the error message

com.kms.katalon.core.webui.exception.WebElementtNotFoundException: Web element with id: 'Object Repository/Page IO-Controller WAN/tbtn_login' located by ....

This message indicates 2 possibilities.

  1. The locator of your Test Object is simply wrong.

  2. The locator of your Test object is right, but actually the Web page doesn’t contain the targeted element.

I don’t know which is the case. Only you can tell it.

It belongs to the second type, the element positioning is correct, but not on this page, I hope to return false instead of reporting an error

Previously I wrote:

Please check this point.

Perhaps you need to edit the Test Case in the Script mode, not in the Manual mode.

Thank you, I understand a little bit now. Every time I looked carefully, I only noticed the verify line. I copied everything you wrote and it succeeded.