cancel
Showing results for 
Search instead for 
Did you mean: 

Element not found after 'waiting' for it to appear

sarcher
Level 3
Hey everyone, So I've got in the habit of developing an object action, like a 'Write' action, that waits for the field to appear before attempting to interact with it. When running the process via control tower (as a robot), I noticed that there will be situations where the 'element cant be found' on the write stage, which is AFTER the wait stage. So, it seems, that it passes the wait stage (telling me that it is aware that the element exists), but then fails because when it comes to writing to that same element, it cant identify it. Is this expected behavior? Because of this I am determining that 'wait for the element to exist' isn't a reliable and 100% effective way to ensure the element is interactable. I seem to have resolved it by adding an additional hard wait before the write action, but best practise says to try reduce the amount of hard/redundant waits. Is anybody able to share some thoughts on this experience? Thanks!
3 REPLIES 3

Denis__Dennehy
Level 15
Waiting for an element to exist should be 100% reliable - I have been using the product for 12 years and I have never seen what you describe. The underlying code is extreamly logical - just a large if statement based upon the attributes you have ticked, it should be impossible for that identical logic to work on a wait stage but not work on your write stage. Potentially your application could be doing something that impacts the element being found - some kind of refresh, or behind the scenes interaction? Also, if you are using a browser automation I recommend using the Parent Document Loaded action instead of check exists in your wait stage - especially for the first wait stage in the action (that option is mentioned in the Browser Automation Guide).

Thanks for your reply Denis. I would have thought that waiting for an element before interacting with it would be reliable, but definitely caught me off guard when it didnt appear to be the case in our one scenario. The application in question is a very simple Win32 app (its just a dialog box that appears for a VPN connection), and so I cant see how any unexpected 'refreshing' behaviour be happening. Its reassures me that, with your experience, the scenario SHOULD be 100% reliable and if it continues to happen then it *must* be something in my model which could be improved upon. Will investigate it more. (its a pity that its not a scenario I am able to replicate while debugging, and only when running via the Control Tower) But thank you for your comments 🙂

NevilleWatson
Level 4
I have seen this kind of behaviour as well. In some instances setting a focus before writing has helped with stability.