I am using Select item activity. The list has about 60 text items. When I add the activity to workflow I can select any of the items manualy and it works great. But I want to select the item by a variable. As soon as I enter string variable which contains correct value form the list into the “Item” property it throws an exception that item is not listed.
The texts are 100% correct. I put delay before 2000 ms and it did not help.
have a check on a failling item if e.g. additional spaces are present. We encountered such differences again and again on different drop downs.
Nope. I use trim function. The texts are totaly the same. This worked in many other my projects before and now I got stuck on such a &#@t
Dne čt 25. 3. 2021 20:58 uživatel Peter | MVP via UiPath Community Forum <email@example.com> napsal:
we hope you had done the analysis within uiexplorer. Have you?
@Roman_Bradac Would you consider using 2 Click activities instead of the select item activity?
1 - Click the drop-down element to expose the available drop-down items
2- Add your variable to the second click selector to click on your specified drop-down item
Yes. The issue is that when the process crashes I see in the studio that only some 20-30 items are loaded in the component.
Dne čt 25. 3. 2021 21:22 uživatel Peter | MVP via UiPath Community Forum <firstname.lastname@example.org> napsal:
Like @Mr_Meeseeks wrote - you can try with those clicks. Check for the selectors for that dropdown list. I had similar issue with dropdown list where there was over 400 item on list. Second click should be simulate type.
If you still had problem, you can use find children and use selector for children for that click
drop downs are not always the same (we talking about web drop downs). It can be a simple one composed by select and options or some more complex implemented by ui Frameworks (div, ul,li, select, option, inputfield)
If the drop down is not reliable following can be done. Check before if the item is available and react accordingly. Strategies for checking the item existence:
- element exists
- find children in combination with an onliner LINQ
So, the flow can be stabilized. A futher analysis on the partly filled drop down is still recommended.
It is not recommended to implement an item existence check by a simple try catch construct as this decreases the validity and reliability of the flow
I assume this linq option is for finding the right children? I think I should definitely learn more about linq. I used find children with filter option and for each loop with if statement and break option when found.
Are you able to show some pattern of that linq code for this case (I know some specifics would be helpful for that…)
lets assume an output from findchildren - var name: uiChildren
filter for a particular item:
uiChildren.Where(Function (x) x.Get("innertext").toString.Equals(YourCheckVar)).DefaultIfEmpty(nothing).First()
check if item is present
uiChildren.Any(Function (x) x.Get("innertext").toString.Equals(YourCheckVar))
I got it. The problem was in the item I was trying to find. It came from PDF and instead of some spaces (char(32)) it contained char(160). I replaced all char(160) with char(32) and everything works now.
Thanks for all the tips it helped me to think different
Dne čt 25. 3. 2021 22:28 uživatel Peter | MVP via UiPath Community Forum <email@example.com> napsal: