Select Item activity not identifying the string from the dropdown when there is a space in string

I’m unable to select a string from the dropdown menu when there is a space in string.

Suppose I want to select a country “French Polynesia” and I’m taking this data from excel. The problem is that Select item activity is selecting “French Guiana” not “French Polynesia”.

image

And it is working fine when I’m putting * (asterisk sign) between the two string eg.: French*Polynesia but I don’t want to use this way.

Thanks in advance.

@RohitK

Try to scrape that element and check the value you get from the selector?

Place a click activity and indicate element on French Polyneisa, and check the aaname how it is generating, according to that you can build your logic

Hope this helps you

Thanks

@RohitK
The find children Activity can Help often in such scenario. Have a Look below for some Starter Help

@ppr
Saw your answer.
You have hardcoded the value “Andean”, In my case, I’m taking the value from excel. Can you tell me how do I mention row.item(“Country”).ToString in below mentioned assign activity or do I have to mention in different Assign activity?

Filterstatement used within assign activity:
uiLists.Where(Function (x) x.Get(“innertext”).ToString.StartsWith(“Andean”)).First

Example:
image

Thanks,
Rohit

Hi @RohitK

in the select item mention the variable as

row(“Country”).ToString

Hope it helps

Nived N

Happy Automation

i would suggest for this:
create a new variable e.g. with the name SearchTerm (DataType: String) and assign the value to it:

grafik

Then use the Filterstatement within assign activity as below:
uiLists.Where(Function (x) x.Get(“innertext”).ToString.StartsWith(SearchTerm)).First

In the log, the FilteredOption is showing the correct value but Dropdown is not selecting anything. It is throwing below error. Even tried putting Click activity before Select activity, still the same error.

image

Give a try to following

  • Use a click Activity and expand the combobox

  • Then use the select Item activity

I tried, still it is showing the same error.

In such a Case WE can approach with following:

  • Run in stepwise Debugging an verify If IT IS working in General
  • For Analysis Set some delays to the select Item activity (delays before setting)

You can use a fuzzy selector there. Please find the below link, jump to 37min and watch…

I tried Debugging, still not working. It is throwing same error when it comes on Select activity. Even the delay before select activity is not working.

I’m able to identify the element and even in log I can see the correct result, it is just not selecting the option. Nothing happens on dropdown and it throws "Cannot select item. It was not found among existing items.

It is working if I’m replacing the space between the string with * wildcard.

Thanks,
Rohit

@RohitK
can you share some more details on the element structure of the combo box. Some boxes are a conglomerato of Ul/li, input textfield, selct/options for implementing auto suggest features. We encountered that such boxes are reacting different but were also automateable.

an example find here:

I found the solution. Thank you everyone for the support. :slight_smile:

image

SelectValue = row.item(“Column name”).Tostring.Replace(Convert.ToChar(32).Tostring,"*")

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