Select Item activity & error handling

Hello and thank you,

I have a Select Item activity and I need it to go to a drop down and click on Update Activity. In some cases the Update Activity is there and in some cases it is not. I need to handle both situations. If it is there then I am good and can continue. When it it not there I need to handle the error. Here is the image. I believe I need to use Try Catch but I’ve never used it before.
2020-03-26_161754
What do I put in the Catches section? I have an If activity which I’d like to insert but it doesn’t seem to allow it.
What is the best way? Would another method work better?

Thank you in advance

Hi,

I suppose perhaps we should check if the dropdown has “Update Activity” using GetFullText activity before Select Item, as the following image.

Regards,

1 Like

@Yoichi - Thank you, I am getting this error message. How do I resolve it?

@gameplayer13905

check the variable scope of text that it is reachable for the if check. Also gie a try on renaming the variable e.g. to strText

As alternate approach in such cases with find children the DropDown items can be retrieved and evaluated. If it is found, tthen it can be used for clicking or selecting. Have a look here


https://www.currency-converter.com/

1 Like

@ppr, @Yoichi

So text in text.Split is a variable?

@gameplayer13905
grafik
text (in my case strText) is a variable of datatype String
Split is the method that you want to use

@ppr - or anyone really. I checked and the variable (I am using UpdateGEMA as the variable) has a scope fitting this section of the workflow. For some reason the If statement isn’t working correctly. I have a Get Full text activity assigned to the above variable and I’m using an If statement as follows:
If
UpdateGEMA.Split.Contains(“Update Activity”)
Then
1
Else
Go do something else
I can see that in this case there is an “Update Activity” in the drop down but it is not seeing it. What am I doing wrong?

Thank you in advance

@gameplayer13905
Just to be sure I got your case right:

  • You want to checkout if a particular item is present in a dropdown box?

Right in that case recommended approach is

  • using find childen to retroeve the existing items
  • evaluate if item is present or not

Let us know if you need help for setting up this with finde children. Starter Help refer also to my post above

@ppr - Thank you again. Yes, sometimes the option Update Activity is there and sometimes it isn’t. I need to take action for either case. I have no experience with Find Children. It looks like I need to do the following from your link:
Find all selectitems with find children (Selector indicated to DropDown, Filter configured to SelectItems)
How do I do this?

@gameplayer13905
I can you encourage to learn new thinks and it is not complex
(we are talking about Webpage/application, right)

Find Children selector has to point to the box
d1

ensure that the selector is set similar like in the screenshot to a SELECT element

Configure it similar to
grafik

Give A try
Filter: "<webctrl tag='option' />"
Scope second options …Descendents
and assign an output variable

@ppr - Thank you, I’ve got this
In Filter:
1
In the Selector I have:
2
but I feel like this isnt something I just type in. How does this data get there?
For the output variable I created Children but I’m getting an error message as follows
3

What is right and wrong?
Thank you again

@gameplayer13905
the selector could / should rewired (indicate item or done by UiExplorer manually with locating in the visually tree and set as target)

the Children datatype seems to be in the wrong datataype. Just delete the variable from variable panels. Click on Output - Children and recreate the variable with STRG+K

@ppr - I know almost nothing about selectors and I don’t understand how to do what you’re suggesting

And what is STRG+K?

@gameplayer13905
You can initiate the creation of a new variable with pressing the keyboard Key CTRL + K
For Selectors Knowledge the courses are available on the ACADEMY : https://academy.uipath.com/lms/