The "ConditionType.EQUALS" not recognized - what import package is required?

Good Evening

I have decided to create Test Object via script.

TestObject dummy = new TestObject(‘dummy’)

dummy.addProperty(“css”, ConditionType.EQUALS, ‘span[name=“CPL413000”]’)

WebUI.verifyElementPresent(dummy, 10, FailureHandling.STOP_ON_FAILURE)

WebUI.verifyElementVisible(dummy, FailureHandling.STOP_ON_FAILURE)

However i believe i am missing an import package (i think), i am getting this command flagged:

ConditionType.EQUALS

So it errors this way:
Test Cases/TO_TEST FAILED because (of) Variable ‘ConditionType’ is not defined for test case.

Thank you
Andrew

Hi Andrew,

it’s

import com.kms.katalon.core.testobject.ConditionType

You can import missing libraries automatically by pressing Ctrl + Shift + o.

3 Likes

Thank you very much Mate!!!

It worked.

Andrew

Mate Mrse said:

Hi Andrew,

it’s

import com.kms.katalon.core.testobject.ConditionType

You can import missing libraries automatically by pressing Ctrl + Shift + o.

Hi, I’m facing the similar issue. I’ve added the mentioned import in script but when I attempt to continue recording via recorder, recorder log says Verification FAILED because (of) Variable ‘ConditionType’ is not defined for test case. This only occurs at the recorder but not the compiler or debugger

I also have the import and it works when I execute it with Action->Run, but when I run the code in the Web Recorder I get the error

2020-04-08 17:15:37.208 ERROR c.k.k.core.main.WSVerificationExecutor - ? Verification FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: ConditionType for class: WSVerification1586384111201
at WSVerification1586384111201.run(WSVerification1586384111201:39)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at

In this URL you will find a link to the javadoc of Katalon Studio API.
In the Javadoc, search for ConditionType.
You will find the fully qualified class name of ConditionType.

The import I used had the fully qualified name com.kms.katalon.core.testobject.ConditionType but it still did not work in the Web record mode. I was able to get it to work by moving the script into a custom keyword.

Ah, sorry, I was out of focus.

I could reproduce your problem on my Mac.

My test case TC1 contains a fragment:

import com.kms.katalon.core.testobject.ConditionType
...
dummy.addProperty("xpath", ConditionType.EQUALS, '//a[@id="btn-make-appointment"]')

When I open the script using the Script-mode editor, the ConditionType class is recognized with no problem. When I run the script, it runs perfect. However, the same TC1 script runs differently in the Web Recorder.

When I click the Web Recorder activation button, I was prompted with a dialog saying "Do you want to continue recording test case: TC1?:

I clicked the button Yes. Then the Web Recorder started with the TC1 script loaded. When I run the script within Web Recorder, the script failed with message

2020-04-10 06:06:36.586 ERROR c.k.k.core.main.WSVerificationExecutor   - ❌ Verification FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: ConditionType for class: WSVerification1586466394571
	at WSVerification1586466394571.run(WSVerification1586466394571:27)
        ....

@duyluong, @ThanhTo, @devalex88

To me, the Web Recorder seems to have a problem in its class loader.

The main process of Katalon Studio GUI seems to create a new class loader to load JVM classes for Web Recorder. And I suppose it forgot to include the com.kms.katalon.core.testobject.* classes into the classpath for the new class loader.

1 Like

Hi, November 2020 and I am having the same problem with the latest Katalon version.
Ist there a solution or workaround for this problem? :slight_smile:

sorry I didnt get it here.
I have com.kms.katalon.core.testobject.Conditiontype imported

Rg

wrong:

right:

import com.kms.katalon.core.testobject.ConditionType

not type but Type.

sorry, just a type-o I actually have it as ConditionType (and with the ‘import’ in front of it):
import com.kms.katalon.core.testobject.ConditionType

The parameter for addProperty() is highlighted correclty by Katalon, so it must be fine.
So it should work like this?

Just try and see.

yes, I see, it is different problem now. I will go on to investigate
Thx