Best practice when clicking/typing an element

What are the best practices when clicking/typing elements.
Should each click/type be accompanied with a find element to ensure the element exists?
Or should each click/type be encompassed within a try/catch block to catch the exceptions?

What are the best practices around the same?
Are there any standard UiPath templates that automate basic web/windows interactions which can serve as a reference?

Hey @jihes84264

Using Find Element is not a best practice as the Click activity itself gonna find the element for you to click.

So basically I will try to list few important points below,

  1. Click activity with the best possible input method like Simulate as first preference

  2. If possible use modern design, where you can verify the click action happened successfully or not else to trigger retry

  3. Choose a proper timeout instead of delay which helps the activity to work in a dynamic way

  4. Wait for ready to be chosen as per the app or element behaviour

  5. The activity you use should be properly named in a meaningful way like the actual action - For example Click Login Button

Hope that helps

Thanks
#nK

Hello @jihes84264

Adding few more to the @Nithinkrishna points.

  • Make sure the selector which in the click activity is stable. If there any dynamic attributes, either remove them by validating in Uiexplorer or use * in teh attribute value.

  • Make use of uiexplorer if there is a requirement to click on elements by passing some values. Then you need to make the selector dynamic.

*Simulate click is faster and supports background automation, but make sure the element is supporting the simulate click

*Always try to use an anchor before to the click activity. In the modern click activity it will directly ask you to select an anchor, which is more stable.