web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot set drop-down c...
Power Automate
Unanswered

Cannot set drop-down country list values on web page

(0) ShareShare
ReportReport
Posted on by 6

Hi,

 

I attempted to use the set-drop-down list value action for the country dropdown list on the "Energy Balances" tab (https://unstats.un.org/unsd/energystats/dataPortal/) but I keep getting the "List doesn't contain option ' Afghanistan '" error message. I was able to use the "Extract data from web page" action to get all the countries in the list which I intend to use a for each loop to set each value in the list in turn allowing me to download as csv. It seems the web page is using Angular and even after using the browser inspect, I still can't determine the selector for the country dropdown list values. Can anyone please help?

 

UNSD_EB.png

 

UNSD_EB2.png

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Dee7 

     

    Give a try like this below

     

    Nived_Nambiar_0-1681268353146.png

     

     

    selector used for click action

    Nived_Nambiar_1-1681268420635.png

     

     

     

     

  • Dee7 Profile Picture
    6 on at

    I tried it but it didn't work. I however made some progress using send keys action but received the following error:

     

    Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Selector: '> document[Class="Chrome_RenderWidgetHostHWND"] > list[Id="mat-autocomplete-0"] > listitem[Name= Antigua and Barbuda ]' is unparsable. Error(s): line 1, column 105 (from position 105 to position 107), Missing ']' at 'and'
    line 1, column 117 (from position 117 to position 117), No viable alternative at input ' ]' ---> Microsoft.Flow.RPA.Desktop.UIAutomation.Core.Exceptions.SelectorParsingErrorException: Selector: '> document[Class="Chrome_RenderWidgetHostHWND"] > list[Id="mat-autocomplete-0"] > listitem[Name= Antigua and Barbuda ]' is unparsable. Error(s): line 1, column 105 (from position 105 to position 107), Missing ']' at 'and'
    line 1, column 117 (from position 117 to position 117), No viable alternative at input ' ]'

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.Proxy.RemoteAutomationRuntimeProxy.HandleResult[T](Func`2 func)
    at Microsoft.Flow.RPA.Desktop.Modules.MouseAndKeyboard.Actions.SendKeys.Execute(ActionContext context)
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.MouseAndKeyboard.Actions.SendKeys.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

     

    It seems the for each loop stops when it gets to "Antigua and Barbuda". I suspect it has something to do with the fact that I used the %CountryItem% without quotes as seen in the screenshot below:

     

    Dee7_0-1681329383030.png

     

    I tried it with the quotes but then the loop doesn't work at all i.e. I get a "Window wasn't found" error message. Is there a way around this?

     

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Dee7 

     

    I think quotes should be there before and after %CountryItem% ,

     

    Also my logic was to make bot enter country name in input field and then click the option that appears below which is Country Name 

     

    Hope it helps 🙂

  • Dee7 Profile Picture
    6 on at

    I tried your suggestion but it didn't work. However, I managed to get it to work now. All I had to do was change the html selector to capture the ids (these are numeric) instead of using the country names. But I couldn't have done it without your suggestion to use the set variable action. Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 178

Last 30 days Overall leaderboard