Cannot access an iOS app element using xpath

204 views
Skip to first unread message

Maria Machlowska

unread,
Sep 19, 2013, 6:20:02 AM9/19/13
to appium-...@googlegroups.com
The problem in topic, I am trying to acces an iOS application's element using xpath.
Appium log:
debug: Appium request initiated at /wd/hub/session/ff4f1220-d4ea-4c0a-ad2c-704c6bc03b86/element
debug: Request received with params: {"using":"xpath","value":"//button[@name='Add']"}
info: Pushing command to appium work queue: "au.getElementByXpath('\\/\\/button[@name=\\'Add\\']')"
debug: Sending command to instruments: au.getElementByXpath('\/\/button[@name=\'Add\']')
....
....
....
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 'function(e, el) {\n        var elid = this.getId(el);\n        results.push({ELEMENT: elid});\n      }.bind(this)')"},"sessionId":"ff4f1220-d4ea-4c0a-ad2c-704c6bc03b86"}


When I try to acces the same element by name, everything works fine.

Dan Cuellar

unread,
Sep 19, 2013, 10:45:27 AM9/19/13
to appium-...@googlegroups.com
We are currently working to provide full xpath support, stay tuned. Not sure what's hapening in you case, can you send me the xpath you used, I can only see the escaped version in the log

Maria Machlowska

unread,
Sep 20, 2013, 4:06:41 AM9/20/13
to appium-...@googlegroups.com
I am really glad, that it is possible to fix the problem with xpath.

The xpath to element I am using in the example above is:
    $xpath = "//button[@name='Add']";
  $this->driver->findElement(WebDriverBy::xpath($xpath));
  $this->driver->click()
;

Dan Cuellar

unread,
Sep 20, 2013, 11:06:41 AM9/20/13
to appium-...@googlegroups.com
For now you could probably get around it with this

    $elementName = "Add";
  $this->driver->findElement(WebDriverBy::name($elementName));
  $this->driver->click()

And yes, I will fix that issue in xpath.
Reply all
Reply to author
Forward
0 new messages