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 / Run js funcion on web ...
Power Automate
Unanswered

Run js funcion on web browser

(1) ShareShare
ReportReport
Posted on by 6

So basically i'm trying to automate filling some web forms. Each row has a button that opens a sub-menu (and i haven't found a way to focus the button with keypresses) so i'm trying to either focus the button, or call the on-click function that the button has, but none of the have worked. 

 

i've tried the following code:

 

function ExecuteScript() { document.getElementById("btn-0").focus();}

or

function ExecuteScript() { AssignValue(0); }

 

AssignValue(0) is the fuction that the button calls. Also, each button has a different id, such as btn-1, btn-2 and so on (same for the fuction, AssignValue(1), AssignValue(2)...)

 

I'm not a web developer so i have no idea why this doesn't work, as executing the code on the web console does work.

I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,501 on at

    Following. I have tried it before, but didnt work. 

  • VJR Profile Picture
    7,635 on at

    @savyexe

     

    Did you try 

    document.getElementById("btn-0").click();

     

  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @VJR . In my case. I am first scrolling down the webpage. Clicking on a button. After clicking the button a pop up window comes in. Then I have to scroll down inside that pop up and click on a button. I am not sure how this will happen. In my JS code, I have written:

    function ExecuteScript()
    {
    document.getElementById('id').scrollTop-=100;
    }

     

    Can you give a suggestion for this? In my case its not able to find the button without scrolling down in that pop up window. 

  • VJR Profile Picture
    7,635 on at

    Can you use "Launch new Chrome" with attach to a running instance option? Attach to this popup using any of the given options. Then add an UI element for the button and then Press button on webpage.

     

    On the other hand also record the actions and it will give some hints and tips about the UI element you want to click and some pre-recorded actions on the PAD code window.

  • savyexe Profile Picture
    6 on at

    Didn't work either 😞

  • savyexe Profile Picture
    6 on at

    I can't do that since the page consists of a list of elements, each with its own identical-looking button, so i would have to add a UI element for each entry on the list, and the amount of entries also varies 

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 258 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 198 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 136 Super User 2026 Season 2

Last 30 days Overall leaderboard