Very Interesting And Helpful Technique in ElectroNeek

  • Appreciated

0 voters

Hey there! I’d like to let you know about a very useful and interesting method that could help you in achieving your goals.

A wrong approach yet very helpful! Previously I wrote an article about Wait For the Element in Some Activities, you can read this article using this link Wait For the Element in Some Activities.

So I was working and just randomly thought, " Wait! I can solve this issue". So basically I wanted some feature in which instead of adding time in the parameters of the click on element activity and other similar activities. We had some feature which automatically wait for the element to appear and then click on it. Because most of the time we either give less or more time in the parameter which results in slowing down the process or gives an error (element not found).

So here I am going to tell you a Cheat Method with which you can achieve this feature. I have used it in my projects and it has given me successful results. But for using this method you should be smart enough to judge where to use it.

In this below picture you can see I attach the flow again to itself, which is coming from the exception end. This means that the Click on element will be working in a loop and the exception flow will be followed until it finds the selected element. It is accurate, makes the flow efficient and reduces the processing time. That means it is solving my problem in best possible way! That is what I wanted!

image

Give it a try and see what amazing results you can achieve! Make sure you have selected the right element and using it in a right way and right place.

I hope you find the topic interesting! Your comments and questions will be highly appreciated. Thanks!

Best Regards,
Muhammad Hayyan Khan

3 Likes

One needs to be very careful when using this cheat method because there is the risk of the bot entering an infinite loop. That might happen in a web automation when the internet conexion dies or something like that. In that case, the element never appears and the bot searches for the element indefinitely, which can lead to serious problems.

My advice is to use a counter with a limited number of tries - for example 20 tries - along with setting 1 or 2 secs for the “Wait before” and/or “wait after” properties. After running out of tries, the process will stop with an error. This way the bot has time to find the element without the risk of and infinite loop.

That being said, I think Wait for element is still the best practice.

3 Likes

Yes! I totally agree with you. There is chance of getting stuck in the loop. So yes in some cases it might not be a good practice. But if you are smart enough to judge where to use it and how to use it. Only then you can achieve the best results from this cheat method.
Even I got stuck in the loop. But I am using it where my Bot is loading the page, which takes time to load. At the same time, clicking on an element gets active in the flow and continuously finds the element and once the element appears clicks on it. So it is saving my time and improving efficiency. Other than that it would have given me error of “element not found”.

And the method you mentioned is also a good practice. I really appreciate you mentioning it. I used it, shown in the image below, and it is working very smartly for me.

image

3 Likes

I agree @cris-dsc , good job, Furthermore, you can use this for any click, whether by image, desktop element, inputs, it gives a performance boost, but as Cris said, you have to be careful not to fall into an eternal loop, a good way to guarantee success is ensuring that the window where you want to execute the action is active.

1 Like