TestProject Forum

The expected element in step #X is missing and test fails

I’m using a local agent running on my machine with an Android emulator.
Part of the test steps I’m recording includes tapping images and firing the tap event.
When recording the test, it finds the elements and manages to tap them. Even running these steps works.
When running the test, it is unable to find the element to tap on and the test fails.
I using Xamarin forms and I noticed that the test manages to tap elements defined in the XAML but not elements defined by code (even though they are declared with id and automationid).

Hi Ido, on the test setting make sure that the following configuration is applied

Automation assistant is ON, adaptive wait and execution speed set to NORMAL.

Make sure you don’t use any explicit waits/pause on a step level, this way all of your steps will get the settings from a test setting.

If it still doesn’t help you can try to reduce the execution speed to slow, it will better reflect human behavior.

Another thing make sure that you using Click action instead of Tap, it has some healing logic inside of it.

let me know if it helps.

1 Like

Hi mark, thanks for the quick reply. Your answer led me to the solution. My assumption was wrong regarding how I added the element to the view.
The issue was with a notification, when the app starts, that covered the element hance preventing the clicking. I set the execution speed manually to wait for the notification to disappear and now the test runs smoothly.