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 / JavaScript not working...
Power Automate
Answered

JavaScript not working in browser automation

(0) ShareShare
ReportReport
Posted on by 12
function ExecuteScript() {
var sources = Array.from(document.getElementsByClassName('gallery-favorite'), div => div.getAttribute('data-id'));
return sources;
}

It works in developer tools console in browser but not with Power Automate. How can I find what is wrong?

It just hangs on forever like it's actually working. Browser Edge.

I have the same question (0)
  • waynewalls Profile Picture
    74 on at

    Not sure why it "hangs on forever."  But here is one thing to keep in mind...

     

    The PAD Run JavaScript action documentation specifies that the return variable be a text value.  Because the Array.from() method returns an array you would likely get a return value from the PAD Run JavaScript action of "[Object object]", if you do get it to run.

     

    If you do get Array.from() to run you could try returning JSON.stringify(sources).  This would get you a JSON string version of your variable sources that you could process further in PAD.

  • Verified answer
    SeniorJoker Profile Picture
    12 on at

    Not that was the problem. Nothing worked at all. Even alert('Text'). Browser internal vpn extension was guilty. When I took out VPN to system level problem gone. Extension somehow affected page. But thanks for trying to help anyway.

  • spmofulton Profile Picture
    66 on at

    @SeniorJokerdid you submit a bug report to power automate? 
    I had a similar issue with VPN last week and disabling the VPN fixed the issue. 

     

    Because so many VPNs require MFA these days, I just started a thread requesting more options for configuring the browser instance for situations like this.   I can link you to the thread if you would like.

  • MMXX Profile Picture
    2 on at

    JavaScript browser automation it's broken on all PAD after ver. 2.26 you will always get [object Object].

    May be related to the new browser extension.

    Use an older version of PAD ver. 2.25 or ver 2.26 and will work perfectly fine.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard