Error in appium when trying to search element with xpath xpression

332 views
Skip to first unread message

Aristotelis Kanellos

unread,
Jan 20, 2014, 3:44:16 PM1/20/14
to appium-...@googlegroups.com
Hi community,
 
I am trying to search an element in my application using the following xpath xpressions but for some reason the third one fails and I can't tell the reason.


...
String tilte = "GroupConv";
String message = "bla bla";
driver.findElement(By.xpath("//cell[@name="+convTitle+"]"));
driver.findElement(By.xpath("//UIAElement[@value="+message+"]"));
driver.findElement(By.xpath("//cell[@name="+Title+"]/UIAElement[@value="+message+"]"));
...

The application as it appear in the Appium inspector has a list of [cell] elements (GroupConv, GroupConv, ...) and its [cell] element has a list of 5 sub-elements.



My goal is to find an element that the name of the [cell] is "UFirstName.." and has a sub-element [element] with value "Ccv". 
With the first xpath xpression, I can successfully find a [cell] element with name "UFirstName..".
Similarily, with the second xpath xpression I can successfully find an element with value "Ccv". 
The problem comes when I want to combine the first two xpath xpressions in one, as shown in the third command.

It seems for some reason that appium does not like this xpath. Is there something specific that appium does not like in this xpath or something that I am doing wrong?

Appium gives the following output

info: Pushing command to appium work queue: "au.getElementByXpath('\\/\\/cell[@name=TFirstName250 TLastName250]')"
info: [INSTSERVER] Sending command to instruments: au.getElementByXpath('\/\/cell[@name=TFirstName250 TLastName250]')

debug: Request received with params: {"using":"xpath","value":"//cell[@name=TFirstName250 TLastName250]"}
debug: Sending command to instruments: au.getElementByXpath('\/\/cell[@name=TFirstName250 TLastName250]')

info: [INSTSERVER] Socket data received (61 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"ELEMENT":"8"}}
info: Responding to client with success: {"status":0,"value":{"ELEMENT":"8"},"sessionId":"c534070d-5300-410c-9917-c11b3e5fce1d"}
POST /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/element 200 1192ms - 109b

debug: Appium request initiated at /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/element

info: Pushing command to appium work queue: "au.getElementByXpath('\\/\\/UIAElement[@value=Ccv]')"
info: [INSTSERVER] Sending command to instruments: au.getElementByXpath('\/\/UIAElement[@value=Ccv]')

debug: Request received with params: {"using":"xpath","value":"//UIAElement[@value=Ccv]"}
debug: Sending command to instruments: au.getElementByXpath('\/\/UIAElement[@value=Ccv]')

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.13.0","revision":"20c368f2963c73eb20cc3bca1585346c31fec387"}},"sessionId":"c534070d-5300-410c-9917-c11b3e5fce1d"}

debug: Request received with params: {}

GET /wd/hub/status 200 2ms - 199b

info: [INSTSERVER] Socket data received (61 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"ELEMENT":"9"}}
info: Responding to client with success: {"status":0,"value":{"ELEMENT":"9"},"sessionId":"c534070d-5300-410c-9917-c11b3e5fce1d"}
POST /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/element 200 1187ms - 109b

debug: Appium request initiated at /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/element

info: Pushing command to appium work queue: "au.getElementByXpath('\\/\\/cell[@name=TFirstName250 TLastName250]\\/UIAElement[@value=Ccv]')"
info: [INSTSERVER] Sending command to instruments: au.getElementByXpath('\/\/cell[@name=TFirstName250 TLastName250]\/UIAElement[@value=Ccv]')

debug: Request received with params: {"using":"xpath","value":"//cell[@name=TFirstName250 TLastName250]/UIAElement[@value=Ccv]"}
debug: Sending command to instruments: au.getElementByXpath('\/\/cell[@name=TFirstName250 TLastName250]\/UIAElement[@value=Ccv]')

info: [INSTSERVER] Socket data received (219 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"'undefined' is not a function (evaluating 'elems.each(function(e, el) {\n        var elid = this.getId(el);\n        results.push({ELEMENT: elid});\n      }.bind(this))')"}
info: Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"'undefined' is not a function (evaluating 'elems.each(function(e, el) {\n        var elid = this.getId(el);\n        results.push({ELEMENT: elid});\n      }.bind(this))')"},"sessionId":"c534070d-5300-410c-9917-c11b3e5fce1d"}
POST /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/element 500 926ms - 359b

debug: Appium request initiated at /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/screenshot

info: Pushing command to appium work queue: "au.capture('screenshot9b2bf8c8-7e30-4f9a-811e-bfd0ffe82bad')"

debug: Request received with params: {}
debug: Sending command to instruments: au.capture('screenshot9b2bf8c8-7e30-4f9a-811e-bfd0ffe82bad')

info: [INSTSERVER] Sending command to instruments: au.capture('screenshot9b2bf8c8-7e30-4f9a-811e-bfd0ffe82bad')

info: [INSTSERVER] Socket data received (48 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
info: Responding to client with success: {"status":0,"value":"iVBORw0KGgoAAAANSUhEUgAAAoAAAARwCAYAAAB6j+UAAABAAElEQVR4AeydB5wTxRfHH7333nvvvYNU6U0QxYIVAQERBAUbKipVVESx8xcUBQRFkKoUxYKIdBCQ3nvv5T+/OWZvs5fkkrvLJXf5PT4hW2Zndr+bS347896bJA2bt7olt4RGAiRAAiRAAiRAAiQQDgSSiCQNh+vkNZIACZAACZAACZAACUQSoACMZMElEiABEiABEiABEggLAhSAYXGbeZEkQAIkQAIkQAIkEEmAAjCSBZdIgARIgARIgARIICwIUACGxW3mRZIACZAACZAACZBAJAEKwEgWXCIBEiABEiABEiCBsCBAARgWt5kXSQIkQAIkQAIkQAKRBCgAI1lwiQRIgARIgARIgATCggAFYFjcZl4kCZAACZAACZAACUQSoACMZMElEiABEiABEiABEkgQBAoVLCDp06eL8bkmj8mRSZMmlVy5coqaSUROnDgpV65e9VpNhvTpJX2G9HL+/AU5d+6c17JxulOdYMVy5aRggfySM2dOOXv2rBw+ckQ2bNosZ86c9dhUnty5JEmSJHL02HG5fv26VS5DhgwaNq77nB/XEtPjrIa9LOA8M2XMKJkyZZR06dJJmjSpJXmy5JIsWTK5ceOGXL9xXS5duiwXLlzQ13xGMbh1i3P/eUHKXbEgkFx97lKrzyD+1oNl+JvImiWLnFXfNdeuXQvWabBdEiCBIBBo1uQO6dals5QsUTwIrfvW5LbtO+SbmbNlyc9LfTvATSl8x1WrUln+/Gt1jL9vYyQAs2TJLF9/8Zk+pcU/LZURI8e4Ob3ITXd36SQP3nevfPXNDPnwk88jdwRwqckdDeWhB+4TKGSnXb58RebM+1E+/2KqXLx4yblbJn88SVKnTiU9n3xK/t223drf/e4u0v2ernp99Zp/ZNCzz1v7vC0Mf+E5qV61ii4SVwxSpkwpefPklpw5ckjy5O5vI0QgXqlSppLM...","sessionId":"c534070d-5300-410c-9917-c11b3e5fce1d"}

GET /wd/hub/session/c534070d-5300-410c-9917-c11b3e5fce1d/screenshot 200 1044ms - 105.53kb


Thank you in advance for your help.
Aristotelis

Jonathan Lipps

unread,
Jan 20, 2014, 4:25:13 PM1/20/14
to Aristotelis Kanellos, appium-...@googlegroups.com
In the current xpath implementation I think you can only filter on the last node

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Aristotelis Kanellos

unread,
Jan 21, 2014, 4:19:19 AM1/21/14
to appium-...@googlegroups.com, Aristotelis Kanellos
Thank you Jonathan. I will look for another way to perform my query.

Eagle Claw

unread,
Mar 10, 2014, 10:24:30 AM3/10/14
to appium-...@googlegroups.com, Aristotelis Kanellos
Hi Aristotelis,

I am in a similar situation where I need to filter xpath's on different nodes, something like //cell[@name="+Title+"]/UIAElement[@value="+message+"],  can you tell me how did you overcome the current limitation with appium's xpath.

@Jonathan,

 I just wanted to check if there were any plans to support xpath filters on different nodes?

Jonathan Lipps

unread,
Mar 10, 2014, 1:54:52 PM3/10/14
to Eagle Claw, appium-...@googlegroups.com, Aristotelis Kanellos
Yes, full-fledged XPath support is coming soon.

For more options, visit https://groups.google.com/d/optout.

slingsho...@gmail.com

unread,
Mar 24, 2014, 6:11:31 PM3/24/14
to appium-...@googlegroups.com, Eagle Claw, Aristotelis Kanellos
Hi Jonathan,

Could you tell us as to when we might expect full-fledged XPath support?

Regards,
Nagendra.

Jonathan Lipps

unread,
Mar 24, 2014, 6:20:53 PM3/24/14
to slingsho...@gmail.com, appium-...@googlegroups.com, Eagle Claw, Aristotelis Kanellos
In Appium 1.0, sometime in the next month or so.
Reply all
Reply to author
Forward
0 new messages