Dynamic selector <ctrl text='{{variable name}}' />

Hello, I’ve been at this for a few of hours but I cant seem to get it to work or find an answer. Would appreciate some help.

What I am trying to do is to get the bot to select an email inside a designated folder based on a unique value that is stored in a variable. But the email title, of course has a few other words besides the unique reference.

Email title: 2) FNOL 2106011 rcvd 1 Jun 2021
Unique reference: 2106011

Unique value is originally in an Excel which I’ve stored in dtFNOLRef variable
Converted dtFNOLRef to stringFNOLRef via Output Table
Used ForEach item in stringFNOLRef with Click activity to click the email

My problem is with my heckin selector… This is what I have.

It’s giving me an error (and a migraine). How could I make it so that it searches ‘within the email title’ please?

@Sophie_D
the requirements for using variables in selectors is

  • datatype has to be string or int
  • for standalone validation variable requires a valid defualt value

if variable value is 2106011 and you want to point to 2) FNOL 2106011 rcvd 1 Jun 2021
then give a try on surrounding it with wildcards: ‘{{varname}}

Maybe you can share some more details with us that we get a better impression on what is meant clicking on email. Thanks

Hi Peter, I tried using wildcards but Im still getting an error. Sorry I wasnt clear earlier, I meant for the bot to select or point to the email with the variable.

The error I am getting it is:

RemoteException wrapping UiPath.Core.SelectorNotFoundException: Could not find the UI element corresponding to this selector:
[1]
[2]
[3]
[4]
[5]

Search failed at selector tag:
[5]

The closest matches found are:
[ 0%]
[ 0%]
[ 0%]
[ 0%]
[ 0%]
[ 0%]
[ 0%]
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

pleas reformat your post with the selector by using the </> button.

maybe you can share us some screenshot on what you want to click, thanks

Test.xaml (12.8 KB)

Here’s what I am working on. Really would appreciate any help!

Yeah sorry Peter but I couldnt, for some reason the forum is giving me an error whenever I try to drag over or paste a screenshot. So I dropped the Xaml instead.

@Sophie_D
We’re not sure if provided XAML is the worked on file as a lot of important settings and wirings were missed out.

However, we do guess that you want to iterate over some FileParts token from the excel and use it for clicking on the corresponding file within FielExplorer.

We suggest to shift the implementation to following pattern:

  • readin Excel
  • loop over the rows
  • retrieve the filename part from a column
  • use the filename part within a dynamized selector within a click

As we do not know more about your case we cannot suggest alternates. In some scenarios it is abetter strategy work over the file names and do the calculation if file is present or not. Also we suggest to handle the case that a file for a particular filename part ist present on the filesystem.

Hi Peter, thanks for your reply, really appreciate it. Actually this is what I am trying to do but I dont know how to fix it. I’ve attached the flow that I am working on. Hopefully the annotations will provide you with as much info as possible.

3.1) Claim_Folder_Setup.xaml (81.0 KB)

I really dont know why but for some reason I can only upload XAMLs. So here’s the Excel table the XAML is working with.

FNOLRef ClaimNo. SISRegistrationStatus InsuredName DateOfAccident IPSIndicator ClaimRef FolderName
2106011 Proceed Capitaland 1 Jul 2020 Non IP - Capitaland - 1 Jul 2020 - Non IP
2106022 Proceed Capitaland 2 Jul 2020 Non IP - Capitaland - 2 Jul 2020 - Non IP
2106033 Proceed Capitaland 3 Jul 2020 Non IP - Capitaland - 3 Jul 2020 - Non IP
2106044 Proceed Capitaland 4 Jul 2020 Non IP - Capitaland - 4 Jul 2020 - Non IP
2106055 Pending Capitaland 5 Jul 2020 Non IP - Capitaland - 5 Jul 2020 - Non IP

And the title of the emails I am trying to search are as follows:

  1. FNOL 2106011 rcvd 1 Jun 2021.msg
  2. FNOL 2106022 rcvd 2 Jun 2021.msg
  3. FNOL 2106033 rcvd 3 Jun 2021.msg
  4. FNOL 2106044 rcvd 4 Jun 2021.msg
  5. FNOL 2106055 rcvd 5 Jun 2021.msg
  6. FNOL 2106056 rcvd 5 Jun 2021.msg
  7. FNOL 2106057 rcvd 5 Jun 2021.msg

Sorry for taking your time but I really cant figure out how to make the selector in the Click activity in the last sequence work :frowning: I keep getting an error - I’ve tried the wildcard and assigning the FNOL reference number to a variable to use in the uiExplorer as well.

The latest error I am getting is this:

Right-click: Could not find the UI element corresponding to this selector:
[1] wnd app=‘explorer.exe’ cls=‘CabinetWClass’ title=‘* - search-‘/>
[2] wnd aaname=’
- search-’ cls=‘ShellTabWindowClass’ title=’ - search-*’/>
[3] wnd aaname=‘Explorer Pane’ cls=‘DirectUIHWND’/>
[4] wnd aaname=‘Shell Folder View’ cls=‘SHELLDLL_DefView’ title=‘ShellView’/>
[5] wnd aaname=‘Items View’ cls=‘DirectUIHWND’/>
[6] ctrl name=‘Items View’ role=‘list’/>
[7] ctrl automationid=‘0’ text=‘2) FNOL * rcvd *.msg’/>

Search failed at selector tag:
[1] wnd app=‘explorer.exe’ cls=‘CabinetWClass’ title=‘* - search-*’/>

The closest matches found are:
[67%] wnd app=‘explorer.exe’ cls=‘CabinetWClass’ title=‘L:\Sophie\0) MyRobotz\5) Capitaland FNOL\0) Robots - FNOL\Daily registrations\1) Capitaland’/>
[67%] wnd app=‘explorer.exe’ cls=‘CabinetWClass’ title=‘L:\Sophie\0) MyRobotz\5) Capitaland FNOL\0) Robots - FNOL\Daily registrations\1) Capitaland’/>
[50%] wnd app=‘explorer.exe’ cls=‘EdgeUiInputTopWndClass’/>
[50%] wnd app=‘explorer.exe’ cls=‘EdgeUiInputTopWndClass’/>
[45%] wnd app=‘explorer.exe’ cls=‘ApplicationFrameWindow’/>
[45%] wnd app=‘explorer.exe’ cls=‘ApplicationFrameWindow’/>
[41%] wnd app=‘explorer.exe’ cls=‘Shell_TrayWnd’/>
[41%] wnd app=‘explorer.exe’ cls=‘Shell_SecondaryTrayWnd’/>
[41%] wnd app=‘explorer.exe’ cls=‘DummyDWMListenerWindow’/>
[41%] wnd app=‘explorer.exe’ cls=‘DummyDWMListenerWindow’/>

In [7], I see text as 2) instead of 2. did you notice is that the issue by any chance.

In addition to above:

vs. [1] wnd app=‘explorer.exe’ cls=‘CabinetWClass’ title=’*** - search- **’/>

Also the Parent/Top Selector is not matched as the error shows

We would suggest to protoype the click selector on a test file. Then dynamize it in a second iteration.

Maybe you can share some details to your process. what is planned to do with file after click?

Hi thanks for that - the close parentheses became a fullstop when I copied it over here in the forum. So no issue on that :slight_smile:

Guysssss! Thanks so much!! This fixed it :smiley:

Can I ask for my learning, when do I decided to use 3 asterisks?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.