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

Notifications

Announcements

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,484 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,484 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard