Transcript for:
Power Automate Desktop: Automating 'Next' Button Clicks

[Music] foreign [Music] let's learn some power automate desktop I received a question from panillan penil wants to know how we can click a next button for example on the search result we want to click it over and over until there's no next button anymore let's go solve it and if you have any power automate desktop question please just let me know know in the channel this is my second day of Channel I love Automation and right now we are zero viewers so I'm sitting here myself if you want to check my main Channel you can just search for anesiansen but let's go solve the problem it's a nice problem and share my screen I replicated the issue so here I make a simple Google search on a refrigerator part I got four pages panilla wants to click next and next no more so here she wants to either fill in some data we can do that in Google but I'm not sure how she will use it or she wants to extract the data out like the Google results let's go create it first we want to launch a browser usually you want just to launch this browser with this particular URL this strategy also works for applications by the way so you can also do it there anyway we will find a launch new Chrome and drag it in instead of launching the new instance I'll just attach it to my running window which was the refrigerator search so here it is then I can click save the strategy here is that I want to click next over and over until we have no next ones usually when you want to do that you want to think in Loops so I'll basically just go to page one check if there's a next button if yes I want to click it that's all there is to this task let me go show you how I will solve that so I'll find a loop I'll use a loop condition and today my keyboard is a bit slow so um I'll find a loop condition I'll make the condition always true so I what I want to do here is that I want to say true and equals true so find a condition that's always true that could be true equals true or 2 equals 2. so now we're looping in then we want to check for the next button and I just want to make a break just so we can see that this actually works so I can say new page this will start at page one and it will continue over and over while we find these Pages here I want to find an if web page contains here bracket in here I will con I will ask for does this page contain contains a next button find it here add the UI element here is the next button I will control and left click we have created the UI element you can see it here span next it might not be enough this it can be that the next button on the next page has a slightly different selector and we will need to fix the address but we will take a look at that when we get there no need no reason to worry now I go up to UI elements go down here and rename it I'll call this next button it's always best practice to rename your UI elements and your variables and everything of course then we want to say if we find the next button then we want to click it so I'll find a click link on web page drag it in if you like these sessions just come back share the Channel with your friends and that's the best help you can give it so then I want to say I don't want to create a new UI limit now because I already have the next button I can just pick that one that's the one I want to click whenever it's present I'll click save but so so this will click over and over but at some point there's no more next button in our case after page four so we want to say if we don't find a next button then we want to do something that is to break out of the loop and we'll do an else so here we have an else and what we want to do is just to find an exit Loop yep drag it in here so let's also have a display message when the actual flow is done just to easily see what's going on and here we will just say flow is done in a real live use case what you want here is that this display message will be your actual flow that could be getting data into the system or getting it out on each page but for now this is fine let's just go do it we are running it and power automate desktop runs and now I think we have a display message here it just were just behind so new page that is page one yep we will have a new page that is page two new page page three new page page four and now we will look for the next button and we know it's not there flow is done that's how easy it is to solve a next button issue we can tune it a bit we can make a calendar so we have a page counter if we wanted it looks like this so I'll find a set variable I'll drag it in up here above the loop condition here I will say page count and we will give it the value one because this is the first page then we want to add one thread in the end of each Loop and here I'll just use the variable pickup I'll say page count equals to page count plus one so each time we are done with this we know there's one more next button because we haven't exit the loop when we're here then we will just add one grid and then we can go up to this display message and say and this is H number and then we will have the page count like this let me click save let's try to run it and let me just make sure since we just attached it and make sure we are on the first page so we have some next buttons to find I'll click run and here we have it here this is page number one and we can scroll down this is right I'll click ok then we'll click into next this is page number two and here you want to do your actions of course you don't want to have a display message just telling what page it is but this is a nice substitute for the actual actions page four that is true now we don't have a next button let's see what's happening when I click ok we're looking our flow is done that's how easy it is to automate a next button again if you have any questions to me around RPA that could be uipath or power automate let me know in the comments I'll I'm here to help you see you [Music] foreign [Music]