Hi All,
I'm trying to get a list of all the options in a dropdown of a web application. For example: this is a amazon site. I want to get the list & count of how many options are available in the highlighted dropdown using power automate.
This list can be dynamic i.e. new options be added or old options can be deleted. My flow should be able to handle this and give exact list of option on that moment.
Is this possible to do using power automate desktop? Kindly help me find a solution of this.
Thanks,
Sakhi Garg
Hi,
The solutions you suggest seem complicated for a non-developer ! I hope Microsoft will add an activity like a "find children" to get all the items from a dropdown list...
Hi @sakhigarg
You can also use the approach suggested by @Henrik_M
Here is another option:
- After running the process, the output is as follows.
On the left hand shown is the the TextList variable which will have all the list of items.
On the right hand side in the Count variable you have the count of items.
- Just copy paste the below code in your PAD editor to get the Flow like the above
@@timestamp: '02/18/2022 10:45:30'
@@source: 'Recorder'
@@recordertype: 'Web'
@@culture: 'en-US'
WebAutomation.LaunchChrome Url: 'https://www.amazon.in/' BrowserInstance=> Browser
WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript()
{
var output = \"\";
var ddl = document.getElementById(\'searchDropdownBox\');
var count = document.getElementById(\'searchDropdownBox\').length;
for (i = 0; i < ddl .options.length; i++)
{
if (i == ddl.options.length-1) //to exclude semicolon for last item
{
output = output + ddl .options[i].text;
}
else
{
output = output + ddl .options[i].text + \';\' ;
}
}
//alert(count);
return output ;
}''' Result=> Result
Text.SplitWithDelimiter Text: Result CustomDelimiter: $''';''' IsRegEx: False Result=> TextList
WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript()
{
var count = document.getElementById(\'searchDropdownBox\').length;
return count;
}''' Result=> Count
Yes.
Use an Extract data from web page action. In its advanced settings, configure it like so:
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2