Create a variable called "counter". Than use "is element exist" to check if element exist and update "counter" variable whenever element is missing. Check counter variable in the loop, and fail thread if "counter" hit 3
Because this question has already been answered on the forum. There is a high probability that the problem is in curly brackets used as a string in BAS actions