Using element exists to go 4 different directions

I’m very new to UI path but getting more comfortable. I am trying to view work items on a website and all have different commands (create, add, delete, remove) and it looks something like this:
image
I am using “element exists” to view the work item and when i click on the word “create,” I came up with this selector and named the variable “workItem.”
image
It was suggested that i use nested if/else statements to go down my 4 different paths but i need to differentiate between create, add delete and remove and perform a different operation for each. So the only thing that would be different for each selector would be the aaname. Is there code that would allow you to do that? i think the issue is turning the Boolean variable and have it look for string. I came up with something like this and tested, it did not work.


Thanks,
Deaser59

1 Like

Welcome to the community!

Try using workItem.ToString.Equals(“Create”) if that doesn’t work try workItem.ToString.Contains(“Equals”)

Check this out too (Comparing Strings in .NET | Microsoft Docs)


Update…

If you are going to stick with the Element Exists Activity you’ll need to set the If Condition to workItem = True

If you are looking to use an If Statement on the Text found in Operation you should use a Get Text Activity and store that Text String to your variable workItem. Then use an If Statement with workItem.ToString.Equals("Create")

Thanks! the Get Text Activity worked perfectly!

1 Like

No problem! Happy developing :smiley: