Skip to main content

Notifications

Power Automate - Power Automate Desktop
Answered

How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

(0) ShareShare
ReportReport
Posted on by

Hi,

 

In Power Automate for Desktop, when you click on a link on a web page, you want a red framed <div> to appear when you place the pointer over the drop-down list, but instead of a <div>, only a <Select> is displayed. Do you know how to set it up?

 

Kind Regards,
Toru 

  • Verified answer
    Toru-san Profile Picture
    Toru-san on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi everyone,

     

    Thank you very much for all your advice.

    I tried out some advanced settings and was able to get the list contents by setting a CSS Selector.

    Torusan_0-1718256083638.png

    I owe this to you all. I look forward to seeing you again.

     

    Kind Regards,
    Toru.

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi Nathan-san,

     

    I tried the follow-up you gave me and got the same results.
    I'll use this as a reference. I'm very grateful.

    Currently, I'm using the company's internal system to create a sample flow and considering whether it can be used for education.
    Many people who use Power Automate Desktop don't know Javascript, so I'll be researching flows that are suitable for everyone and rolling them out to others.

     

    Thank you very much.

     

    Kind Regards,
    Toru.

  • NathanAlvares24 Profile Picture
    NathanAlvares24 1,673 on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi @Toru-san !

     

    Try using action 'Run Javascript function on web page'.

     

    So I am trying to extract this:

    NathanAlvares24_1-1718223207818.png

    I want all those drop down values in a list or something.

     

    Here is an example of my flow:

    NathanAlvares24_0-1718223170498.png

     

    You can use either of these JavaScript codes:

    1)

    function ExecuteScript() {
     var titles = '';
     var selectElement = document.getElementById('searchGranularity');
     if (selectElement) {
     var options = selectElement.getElementsByTagName('option');
     for (var i = 0; i < options.length; i++) {
     var title = options[i].getAttribute('title');
     if (title) {
     if (titles !== '') {
     titles += ', ';
     }
     titles += title;
     }
     }
     }
     return titles;
    }

     

    2)

    function ExecuteScript() {
     var titlesArray = [];
     var selectElement = document.getElementById('searchGranularity');
     if (selectElement) {
     var options = selectElement.getElementsByTagName('option');
     for (var i = 0; i < options.length; i++) {
     var title = options[i].getAttribute('title');
     if (title) {
     titlesArray.push(title);
     }
     }
     }
     return titlesArray.join(', ');
    }

     

    Result:

    NathanAlvares24_2-1718223305191.pngNathanAlvares24_3-1718223316577.png

    NathanAlvares24_4-1718223327351.png

     

    In this way, you can use this for any drop down boxes in any website. Just make sure to update the id value fitting to the id element of that select in that web page.

     

    I hope this helps.

  • AK88 Profile Picture
    AK88 453 on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi @Toru-san ,

     

    I would suggest to go through this url https://www.youtube.com/watch?v=QllyIdxm4H0 , hope this would solve the issue.

     

     

    thanks,

    if it resolves your query kindly mark it as solution and give kudos!

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi Agnius-san,

     

    Thank you for your reply. 

    I checked various websites and everyone seems to have a simple solution. However, I don't understand the procedure. Could you please explain it in detail?

     

    Kind Regards,
    Toru.

  • Agnius Bartninkas Profile Picture
    Agnius Bartninkas 10,045 on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    You need to do the extraction with the drop down list expanded in the browser, and target the individual values of the list, not the parent <select> element.

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi AK88-san,

     

    When selecting from the list, does the arrow in the image below need to change to "Table" instead of "Select" in order to select? I've checked a number of sites, and this is the only difference.

    Torusan_0-1718155156934.png

    Kind Regards,
    Toru.

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi AK88-san,

     

    When I operate it, it looks like the image below.
    It seems that the list is not selected during the operation process.

    Torusan_0-1718147115730.png

     

    Kind Regards,
    Toru.

  • AK88 Profile Picture
    AK88 453 on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi @Toru-san ,

     

    Please let me know how you're extracting. I'll mention below the steps to do the extraction using the same action.

     

    1. Hover your mouse to the position where the elements need to be chosen.

    2. Kindly give right click and choose 'Extract Element Value' , then choose the attribute needed.

    2. if you need a table, choose the next row from the list, this will be automatically forming as a table.

     

     

    AK88_0-1718085233421.png

     

    Kindly check and let us know.

     

     

    thanks,

    if this resolves your query kindly mark it as solution and give kudos!

     

     

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to select from a drop-down list on a web page according to a variable in Power Automate for Desktop.

    Hi AK88-san,

     

    Thank you for your reply. 

    I have been using "Extract data from web pages" since before making this post, and it looks like the image below. There are some differences from the image you replied to. I would like to isolate the problem. Looking at the image below, does it seem like there is something I'm doing wrong?

     

    Torusan_0-1718068967205.png

     

    Kind Regards,
    Toru.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard