waitForElementVisible fails to detect element intermittently

I am using UI vision to automate inserting data into an application form. The form has several page transitions, and I am using a combination of waitForElementVisible (an element only found on the next page) followed by waitForElementNotVisible (waiting for loading spinner to disappear) to cleanly capture page transitions events.

However, on a particular page transition, waitForElementVisible randomly fails to detect a clearly visible element (a text input field), and simply waits for it to “appear” until it times out.

I have compared the expected and actual xpaths, and they are always identical. I am unsure how to debug this further…

I recommend replacing waitForElementVisible by visualAssert. This command waits until the image is found/appears. This bypasses dealing with page internals and XPath.

If you want to keep using waitForElementVisible (which has the advantage that it can run in the background): Can you post a test macro here?