It’s a string. I’ve tried changing it to a string, generic, and I’ve even tried changing it to a Jobject.
I’ve been stuck on this one dropdown list for 2 days. I just want it to select the string I want.
I think that because of the way this webapp was built, it’s really difficult to find a good selector.
Here is the full Selector for the SPAN element that contains the two DIVs
I want to select only one of the DIVs
I already have a variable that is going to store the string I’m searching for in the dropdown list called adjReason.
Which contains something usually like this: “Service & Equipment (MR/SC)”
I tried replacing the & with * And the invalid cast exception went away, but then it couldn’t find the element, wasn’t a good selector…
Nothing I’m trying is working. I just want it to click on the option I want it to click on!
I’m starting to get frustrated because I’ve been on this one problem for so long.
I’m off work now, I’ll be back on tomorrow. If you have any ideas please share.
Note: The only thing I was able to successfully do so far was to use a find children activity to find the elements inside the SPAN, and I’m able to loop through them until the item.Get(“innertext”) = adjReason.
The problem I had doing it that way, is that the list of reasons can be pretty long, so I wanted to use a one liner type of query so that I could only retrieve that one element from the list of reasons and then click on it. But I haven’t had any luck there either. I did post that issue as well on the forum.
I would suggest not using css-selector. You should be able to just use parentid or parentclass.
What you can do is in the 18.4 or newer version of UiPath, using UiExplorer on the element, click on Highlight so it surrounds the element it finds with a box (so you know it selects the right one. Then, uncheck “tableRow”, so only attributes used are “parentid” and “tag”. — also click on Validate
Is this a dropdown element? I would suggest using your new selector on the Select Item activity, because then you can use adjReason as the item to select. However, this activity is not always compatible. If you need to use Click automation, then you will want to find the selector of the individual item… then, you can possibly use the aaname on that. — in your image, the aaname is the entire list which suggests that you selected the entire dropdown element rather than the individual item.
The ampersand (&) is part of other characters that represent usually a quotation or a special character. In your case, > is the entire character which you would need to wildcard, not just the &. However, like I mentioned, I don’t think you should use that attribute at all.
It’s difficult identifying the solutions needed. If you can show some of your activities and how you have them set up, it may help. Also, if it’s a website accessible to us (though not likely), then we can identify how to select the item.
Looks like you are on the right track though. I would recommend looking over your selector for any weird characters like this one:
to solve the invalid cast error.