TestProject Forum

During the test the path of the element changes and the step fails

hello community testproject
I ask for help in solving the problem of iOS 14.7.1
I created an element with a unique path, but during the test, the created element is located by the inspector in different ways, the element path changes and the test gets an error.
For example
created path //XCUIElementTypeAny[2]//XCUIElementTypeButton[2]
the path is found by the inspector //XCUIElementTypeCell[1]//XCUIElementTypeButton[2]

Hi @zeleznov.sergey,
In this case if your element is dynamic you can try to find a more dynamic xpath,
For example xpath that find by text or by class name or by id.

An example of a locator that find using text -

In this cas you can find an element by the value of the element “WI-FI”

You can also follow this to learn more about locating techniques

Please let me know if that solved your issue.