Unable to click Object despite verifyElementClickable returning true

@kazurayam
Surely I’d better write XPath as flexible as possible.
Thank you for telling me.

@shunmatsu_begginer

Please note that the pitfall @kazurayam is pointing out is a well known issue with XPath - it’s very sensitive to subtle changes in the source document. This is even more noticeable the longer your XPath becomes - always try to create the shortest XPath possible. That way, you’re creating a path with the least amount of potential failure points.

If you used CSS, you wouldn’t have this particular problem. These two CSS selectors are semantically and functionally identical:

div.navbar-collapse.collapse ul > li

div.collapse.navbar-collapse ul > li

You could use either of these in the same test against the same page.

And, if I need to point it out, look how much shorter they are :stuck_out_tongue_winking_eye:

1 Like

This is even more noticeable the longer your XPath becomes - always try to create the shortest XPath possible. That way, you’re creating a path with the least amount of potential failure points.

Thank you for letting me know the other important points.
I’ll try to find a better way to write XPath.

Hi,

I’ve been getting this error message, even the simplest script won’t run. I can navigate to url, but won;t be able to click any element. Works on my local pc but not on my VM. Thanks.

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: -1: unable to resolve class internal.GlobalVariable
@ line -1, column -1.
1 error


com.kms.katalon.core.main.ScriptEngine
runScriptWithoutLogging
104


com.kms.katalon.core.testobject.ObjectRepository
findWebUIObject
271


com.kms.katalon.core.testobject.ObjectRepository
readTestObjectFile
225


com.kms.katalon.core.testobject.ObjectRepository
findTestObject
183


com.kms.katalon.core.testobject.ObjectRepository
findTestObject
136


com.kms.katalon.core.testobject.ObjectRepository$findTestObject
callStatic


LinkedIn
run
23


com.kms.katalon.core.main.ScriptEngine
run
194


com.kms.katalon.core.main.ScriptEngine
runScriptAsRawText
119


com.kms.katalon.core.main.TestCaseExecutor
runScript
393


com.kms.katalon.core.main.TestCaseExecutor
doExecute
384


com.kms.katalon.core.main.TestCaseExecutor
processExecutionPhase
363


com.kms.katalon.core.main.TestCaseExecutor
accessMainPhase
355


com.kms.katalon.core.main.TestCaseExecutor
execute
251


com.kms.katalon.core.main.TestCaseMain
runTestCase
114


com.kms.katalon.core.main.TestCaseMain
runTestCase
105


com.kms.katalon.core.main.TestCaseMain$runTestCase$0
call


TempTestCase1607296719208
run
25


0
false
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: -1: unable to resolve class internal.GlobalVariable
@ line -1, column -1.
1 error

at com.kms.katalon.core.main.ScriptEngine.runScriptWithoutLogging(ScriptEngine.java:104)
at com.kms.katalon.core.testobject.ObjectRepository.findWebUIObject(ObjectRepository.java:271)
at com.kms.katalon.core.testobject.ObjectRepository.readTestObjectFile(ObjectRepository.java:225)
at com.kms.katalon.core.testobject.ObjectRepository.findTestObject(ObjectRepository.java:183)
at com.kms.katalon.core.testobject.ObjectRepository.findTestObject(ObjectRepository.java:136)
at com.kms.katalon.core.testobject.ObjectRepository$findTestObject.callStatic(Unknown Source)
at LinkedIn.run(LinkedIn:23)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:393)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:384)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:363)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:355)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:251)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1607296719208.run(TempTestCase1607296719208.groovy:25)
org.codehaus.groovy.control.MultipleCompilationErrorsException startup failed: Script1.groovy: -1: unable to resolve class internal.GlobalVariable @ line -1, column -1. 1 error 2020-12-07T07:19:12 1607296752700 27 INFO com.kms.katalon.core.logging.XmlKeywordLogger logMessage 29 MHTML is available at /C:/Users/NGLIC012/AppData/Local/Temp/Katalon/Test Cases/LinkedIn/20201207_071839/Test-Cases_LinkedIn.mhtml 1 false 2020-12-07T07:19:12 1607296752710 28 END com.kms.katalon.core.logging.XmlKeywordLogger endTest 1 End Test Case : Test Cases/LinkedIn 0 false

@ilonahjeanp.macarana

This thread “Unable to click Object despite verifyElementClickable returning true” is already closed, and the title does not describe your problem properly. Please create a new disscussion for your case.

Also,please enclose your code fragments with triple backticks to form CODE BLOCK presentation to make it readable.

スクリーンショット 2020-11-30 11.00.05

This makes

    Your "code" 'here'