Search code examples
iphoneobjective-ciosinstrumentsios-ui-automation

iPhone - Automation testing?


I am currently detecting elements by their accessibility labels when writing automation testing? This causes a lot of problems.

  • Is this the correct way of detecting elements?
  • If not is there a better way to detect elements without using the accessibility label?

Solution

  • UI Automation uses the accessibility label (if it’s set) to derive a name property for each element. Aside from the obvious benefits, using such names can greatly simplify development and maintenance of your test scripts.

    The name property is one of four properties of these elements that can be very useful in your test scripts.

    • name: derived from the accessibility label
    • value: the current value of the control, for example, the text in a text field
    • elements: any child elements contained within the current element, for example, the cells in a table view
    • parent: the element that contains the current element

    Instruments User Guide