...\BrowserAutomationStudio\release"ScriptName"\appslocal\e3b0c442\SID505939e4\engine\prof
Check this folder for temporary profiles. They should be deleted after finishing work.
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