SelectItem not finding item

[I have a solution which I’ll post in-line after the original post text here.]
I have a form which I’m automating. At one point on the form I need to search for a phone number, then select the number from a list if it is found by search.

I’ve replaced the number since my examples are real #s and I don’t want to expose that data, but otherwise this is an accurate image.

Under the hood, the selector looks like this:

<select class="form-control" id="list1" name="list1" size="0" style="visibility: visible; width: 300px;" uipath_custom_id="6">
	<option value="">-- Select One --</option>
	<option value="8005551234">8005551234 - </option>
	<option value="8005551234">8005551234 - 911</option>
</select>

I was trying to select the value as displayed (with the “-”) and I also tried it without the dash. Neither works. I noticed that the value for both selections is actually the same, even though the displayed text is different.

Here is the error I get when I try a select:
“Try Selecting Item: Cannot select item. It was not found among existing items.
TIP: Some combo-boxes delay load items until its dropdown is expanded. Try to simulate a click on control prior to selecting an item.”

I’ve read that I should try using a “click” and then a “type into” to try working around the issue when select fails, but that combo didn’t work either.

Within this app the selectitem has worked flawlessly up until this form and the only weirdness that I see is that both the options (despite different visuals) have an underlying value that is the same. Still, I’d have kind of expected that the bot would just click the first one or the second - but instead nothing happens and it finally throws this error.

If I wrap it in a try/catch it just never selects anything and then the form fails to submit because an item must be selected.

Any ideas or suggestions? (Again, I’ve tried the CLICK + TYPE combo and it was the same results as the SELECTITEM. No joy. :pleading_face: )

==========================

Ok - the fix for this was a mixture of tricky and dumb. But thanks to everyone who offered suggestions!

First, I did end up replacing the “SelectItem” with the Click + TypeInto pattern. While troubleshooting, I actually had the Select and then the TypeInto in my workflow so I could try both. Ultimately, the latter was more effective.

But here’s the important bit (and also the stupid bit): When I wanted to make sure that the values I was passing into the Select matched the correct value, I could clearly see that the pattern was: PHONE-NUMBER + SPACE + DASH + SPACE.
This was how it looked visually, and how it looked when I used Dev Tools to examine the underlying HTML.

While working on the issue, instead of examining the element with the Dev Tools I accidentally opened the “view source” for the whole page and then tried to find that pattern of "8005551234 - " and couldn’t find any hits for it. THE SPACE AFTER THE - DID NOT EXIST!?

When I removed the extra space (which CLEARLY showed up inspecting the element) in my var for the selector, it worked fine. I’m going to chalk that one up to “WTF?” and move on, but my confidence in the browser dev tools for inspecting code is shaken.

Hi,

It seems to be trimed whitespace at the end of the string. So can you try the following string in SelectItem activity?

"8005551234 -"

Regards,

1 Like

Refer to you selector, the value should include space as highlighted in the screenshot below. It should be "8005551234 - " . You have to check how many spaces are there as it is difficult to determine 1 or 2 spaces by eyes.

1 Like

Try to give -
image
wait after you click and try.


Works perfectly as below:

image

I did do that. I took the selector code and counted the spaces then constructed my variable to match exactly, but sadly that didn’t work. I also tried matching the value - and that also didn’t work, but I do appreciate the suggestion. I even looked for hidden chars but this doesn’t seem to be a factor.

Still, it’s excellent advice.

This was the fix.

Didn’t see this till I’d already found same - but yes. There wasn’t really a space at the end.

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