How to check a text area is disabled/enabled ?

I want to check a text area is disabled or enabled, I use “verifyElementClickable” but not successful, and get below error :

Test Cases/TCC_hoantra FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to verify object ‘Object Repository/Page_TI CHNH CNG/textarea_Ni dung_ct_noidung’ to be clickable (Root cause: Object ‘Object Repository/Page_TI CHNH CNG/textarea_Ni dung_ct_noidung’ is NOT clickable)

at

Hi Bui,

You should inspect the object attributes. I’m sure there’s a property there that indicates whether the object is enabled or disabled. Or, maybe the main locator is changing like the ID or name.

If that happens use the WebUI.verifyElementAttributeValue.

Hope that helps… :slight_smile:

Arnel said:

Hi Bui,

You should inspect the object attributes. I’m sure there’s a property there that indicates whether the object is enabled or disabled. Or, maybe the main locator is changing like the ID or name.

If that happens use the WebUI.verifyElementAttributeValue.

Hope that helps… :slight_smile:

I can not find that property. Please see my attached file

NoiDung.PNG

Hi Bui,

In that highlighted line, is the behavior of the text box enabled or disabled?

I think the id changes when it is enabled or disabled. Try to observe.

Could you send the property when it is enabled or disabled?
like e.g.:
//when it is enabled, it looks like this

or

//when it is disabled, it looks like this

Thanks.

@7314-Arnel: Hi Arnel, I can verify now but it stopped immediately after this command, how I continue after that

Unable to verify if object ‘Object Repository/Page_TI CHNH CNG/textarea_Ni dung_ct_noidung’ has attribute ‘disabled’ with value ‘false’ (Root cause: Object ‘Object Repository/Page_TI CHNH CNG/textarea_Ni dung_ct_noidung’ has attribute ‘disabled’ with actual value ‘true’ instead of expected value ‘false’)

This is my command:

if (WebUI.verifyElementAttributeValue(findTestObject(‘Page_TI CHNH CNG/textarea_Ni dung_ct_noidung’), ‘disabled’, ‘false’, 20))

{ xxx...

}

Maybe the ‘disabled’ attribute is not present when the text box is enabled.

Can you show the html source?

@7314-Arnel: Katalon can check the attribute “disabled” as message: has attribute ‘disabled’ with actual value ‘true’

But it stopped because my if condition is … “false”. How can I pass this ?

Do you have an else in your if block?

Try to put an else to catch the false condition.

@7314-Arnel: Yes I have,

This is my example



if (!WebUI.verifyElementNotClickable(findTestObject('Object Repository/Page_TI CHNH CNG/button_Lu'), FailureHandling.CONTINUE_ON_FAILURE))
    {

        WebUI.setText(findTestObject('Page_TI CHNH CNG/textarea_Ni dung_ct_noidung'), content + ' Test')
        WebUI.click(findTestObject('Object Repository/Page_TI CHNH CNG/button_Lu'))
        def results = WebUI.getText(findTestObject('Page_TI CHNH CNG/div_ORA-06502 PLSQL numeric or'))
        println(results.toString() //WebUI.click(findTestObject('Object Repository/Page_TI CHNH CNG/span_OK_glyphicon glyphicon-ok'))
            )
        if (!(results.toString().startsWith('Da Tao chuyen tra cho lien ngan'))
            && ! results.toString().startsWith('Tạo chuyển trả thành công')) {
            KeywordUtil.markFailed('Message does not contain expected text.')
        }
    }
    else 
    {
        println(content.toString())
    }

And this is the exception message

Test Cases/TCC_hoantra FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Object ‘Object Repository/Page_TI CHNH CNG/button_Lu’ is clickable
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:32)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementNotClickableKeyword$_verifyElementNotClickable_closure1.doCall(VerifyElementNotClickableKeyword.groovy:80)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementNotClickableKeyword$_verifyElementNotClickable_closure1.call(VerifyElementNotClickableKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:21)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementNotClickableKeyword.verifyElementNotClickable(VerifyElementNotClickableKeyword.groovy:96)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementNotClickableKeyword.execute(VerifyElementNotClickableKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyElementNotClickable(WebUiBuiltInKeywords.groovy:577)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyElementNotClickable$9.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at Script1541382521574.run(Script1541382521574.groovy:64)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:183)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:108)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:294)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:285)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:264)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:256)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:200)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:99)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:90)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
at TempTestCase1541574831291.run(TempTestCase1541574831291.groovy:22)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
at groovy.lang.GroovyShell.run(GroovyShell.java:518)
at groovy.lang.GroovyShell.run(GroovyShell.java:507)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
at groovy.ui.GroovyMain.run(GroovyMain.java:384)
at groovy.ui.GroovyMain.process(GroovyMain.java:370)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
at groovy.ui.GroovyMain.main(GroovyMain.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
)

Test Cases/TCC_hoantra.run:64