Through Appium inpector, we are unable to see ID/Resource-ID attributes for IOS webview(cordova) app

Hi All,
I’m trying to test our Cordova app in Appium. When I view the elements in the Appium Inspector, they don’t seem to have anything that I can use as far as identifiers.

I am setting various things in the HTML for this element, such as id, name, etc. (it also has a label that is using the for attribute that points to the input.) but it does not appear to have anything that I can look for. So I end up looking for UIATextField elements with value
of Email. This is undesirable since I do not have a consistent way to
look up inputs. For example, if I change the value of the input, I would
need to look up the element by that new input.

So my question is: how can I set accessibility identifiers or any
handles for this element from the HTML from Cordova? I would even take data-* attributes that I could query for. Or am I going about this incorrectly?I ask about accessibility identifiers since I have read in other places that I should not use XPath selectors for Appium tests, but I can see no clear reason why this is the case (it seems to work for me.)

Please suggest us.

Thanks,
Durga Prasad

Hi Durga:
I would recommend

  1. Use arc to Set your context to the webview context output in the available_contexts (ruby) command
  2. Inspect using the appium inspector magnifying glass
  3. Bottom right - click copy xml
  4. Copy off to a file and use generic selenium xpaths

Eric