Clicking the same button on different pages


Firstly I am very new to using UI Path so this is probably a very simple question. I did do a search on the forum but couldn’t find an answer.
Basically I have a spreadsheet with lots of URL’s in it which each lead to a form I want to download. I have managed to do a for each row loop to open each of the URL’s one but one but my problem happens after that.
When it opens the first page I set it to record my actions and then I click the options and download button.
This works on the first page and it downloads fine, however on the second page it fails because although it’s the same button in the same place physically it’s still looking for the button at the URL where I originally made the recording. So I assume this is a selector issue but I can’t work it out.

Is there a way I can get it to click the options and then download button on multiple different pages?

If you need any more info let me know and thanks in advance for the help.

Hi @JamesITP,

Thats really a good question to start with buddy…! Welcome to UiPath Forum…:slight_smile:

So its glad that you found the root cause of the issue… Yes it’s all because of selectors only…
kindly provide the selector of the above activity for two different pages by manually getting to that page. With that we could easily solve the problem by finding the difference between the selectors and replace it with wildcards like * or ?


Hey @JamesITP,

You’ve mentioned that you are redirecting to different URLs.
I have a question for that.
Do those webpages have the same look/design?
If yes, then what you will do is use wildcards on the selector. Replace the URL with the ‘*’ wildcard.

Hope this helps :slight_smile:

Thanks for the replies.

I looked at the selector from two different pages and the differences are the title and the URL. If I * them out then it can’t find the object.
So basically this button is in the same place on every page, it’s just different URL’s:

<html app='firefox.exe' title='TEST Document for Internal and demo ONLY-itpdirectdebitform | Si*' />
<webctrl src=';lang=en&amp;projectId=0e7*' 
tag='IFRAME' />
<webctrl css- selector='body&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;button&gt;span' idx='1' tag='SPAN' />

<html app='firefox.exe' title='ITP Non-Disclosure Agreement | SignNow' />
<webctrl src=';lang=en&amp;projectId=1cc*' 
tag='IFRAME' />
<webctrl css-selector='body&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;button&gt;span' idx='1' tag='SPAN' />

If I * out the URL it still validates but only on the one page with the correct title.

<html app='firefox.exe' title='*' />
<webctrl src=';lang=en&amp;projectId=*' 
tag='IFRAME' />
<webctrl css- selector='body&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;div&gt;button&gt;span' idx='1' tag='SPAN' />

@JamesITP, try this

1 Like

Hi @JamesITP,

Your title looks dynamic, kindly replace it with wildcard * with its value as suggested earlier, This would work for sure… You are doing good…1


Hi guys, thanks for the reply’s.

From what you have put it makes sense to * the title and * the part after project id. However when I tried this it just failed to find anything at all. So I thought I would re record the actions and try again, now even with them re recorded and un edited it’s still not working where it was before. I’m not sure it isn’t just this website being a bit difficult for it to easily find them?
I open edit selector, click on indicate element, it then validates and goes green but if I close that screen and re open it again it fails to validate again.

Given that the button will always be in exactly the same place on every page and I only need to run this whole thing successfully once. Is it possible to use the mouse cursor’s X Y coordinates as the selector? That way it just clicks in the same place on each page?

Since you want to click the same button on multiple pages, I would suggest to use click image, if the image of the button is same.

Let us know if this helps,
Pavan H


Thanks for the idea. However I don’t think the button is an image. When I right click it I don’t get the save image as option and when I try to do the click image recording and click the button it just comes back blank.

Hello @JamesITP,

There are two ways here to interpret the click image idea. For one, there’s the standard click image activity that would require that you draw a rectangle around the image in order to capture what you want UiPath to look for. This is not suggestible as it’s much slower and must also run in the foreground.

Instead, another way to interpret it is that the button could have an image source that’s the same across all of the pages. In this example, you would have your selector looking for the button’s image tag and searching to match the src.

Either of those however are likley unnecessary, I would strongly suggest changing your selector to be page independent (something like*), and also looking to see if there are any selector parts that are unique to that button. Likely it will be a part of a menu div and have an aaname like “Config” or “Options”.

Thanks for the reply. It does have an aaname as “Options” however I think it’s just something to do with this site and the way that the button works that causing me an issue.
If I edit the selector and then click Indicate Element, then click on the options button it fills out the selector window with all the info I need and the validate button goes green. However if I close that selector editor window down and open it again, or just click validate again the validate button goes to red with a cross through it even that I haven changes anything! I haven’t even run the program. It seems that even though it can grab the details for the button they become invalid straight away.

That’s why I wondered if the mouse xy could be used as a selector, because the button will always be at the same place on the screen as each page is opened.

From the looks of what was posted above, the suggested selectors were not cleaned. Some websites will be generated by other code, like in the case of webapps. In that case, it may unnecessarily change the structure of the website as well as the ID’s of the elements. You may have to be careful in terms of what you select and what you don’t. It boils down to informed trial and error. If you have not already done so, I would strongly suggest going through Lesson 6 of the Foundation training. Selectors are a big deal in UiPath, and it would be very beneficial to have a good grasp of how to change them.

Hey JamesITP,

As suggested earlier by pavanh003 you can use click image and mark the button on the webpage, as these activity look for the marked image on the screen while executes.

Ex : image

HI @ JamesITP
As shown in these selector you can un select webctrl css-selector from edit selectors as i suspect there is an “idx=1” which may change for different websites.


Thanks for all your help on this one guys. I had loads of problems with it working on that button for some reason. Even to the point where it would work one min and then stop working without me changing anything.
In the end I just used a click activity and put in the coordinates of the button. I only need to run this automation once and the button will always be in the same place so it worked fine for me.

I feel like I have learnt some good tips through going through all the help in this thread though so thank you.

1 Like