Invalid Selector Exception

WebElement NavigatorTree = WebUiBuiltInKeywords.findWebElement(to);
List<WebElement> mainNode = NavigatorTree.findElements(By.cssSelector("ul[class='treeview']>li"));
WebElement NodeFound = mainNode.get(0)		// confirmed it has the node, by getting gettext()
List<WebElement> SubNodes = NodeFound.findElements(By.cssSelector(">ul>li"))

Hi All,

Thanks for taking time.

My code fails on the last step. I am trying to navigate a tree, I find the main node and now I need the elements within that node.

Please let me know if any other information is required.

Console message:

11-21-2018 08:56:40 AM - [ERROR] - No such property: detailMessage for class: org.openqa.selenium.InvalidSelectorException

11-21-2018 08:56:40 AM - [END] - End action : oWeb.cWeb.NavigateWebTree

11-21-2018 08:56:40 AM - [ERROR] - Test Cases/Navigator_WebTree FAILED because (of) (Stack trace: groovy.lang.MissingPropertyException: No such property: detailMessage for class: org.openqa.selenium.InvalidSelectorException

at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)

at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:66)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)

at oWeb.cWeb.NavigateWebTree(cWeb.groovy:143)

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.reflection.CachedMethod.invoke(CachedMethod.java:93)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)

at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:144)

at oWeb.cWeb.invokeMethod(cWeb.groovy)

at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:46)

at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)

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 Script1542743663092.run(Script1542743663092.groovy:18)

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 TempTestCase1542815793239.run(TempTestCase1542815793239.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)

)

can we see your code?

Thanks B L.

The code is already there in the previous quote. I was able to resolve it. It did not like the css selector. NodeFound.findElements(By.cssSelector(">ul>li"))

After changing it to NodeFound.findElements(By.cssSelector(“ul>li”)), it worked

1 Like