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 / Unable to extract href...
Power Automate
Answered

Unable to extract href (hyperlink)

(0) ShareShare
ReportReport
Posted on by 37

Dear Community,

I am not able to extract href value using 'record' option from eBay link (air force 1 custom | eBay), you will notice that even though the mouse 'turns' to hand symbol (indicating hyperlink) but PA is unable to fetch the same. I even tried to use Javascript, but even that returns '[object Object]' (basically NOT the url I need):

 

function ExecuteScript() { 
return document.getElementsByClassName("srp-results srp-grid clearfix")[0].getElementsByClassName("s-item__image-section")[0].getElementsByClassName("s-item__image")[0].children[0].href
}


Please help!

Thanks,
Sai

saimrpp_0-1699382305555.png

Error_1.pngError_2.pngError_3.png

  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    Have you tried with

    extract data from web page

    and get details of the element on web page?

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    This is because you are targeting the wrong element. There is no href on the <span> element. It's on the parent <a> element:

    Agnius_0-1699426027964.png

    You can capture the <span> and then simply remove the two last items of the selector (the div > span) so that the end of your selector is an <a> element.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • saimrpp Profile Picture
    37 on at

    I am a bit of novice with HTML, can you be little more specific please?

    If I use: 
    1. document.getElementsByClassName("srp-results srp-grid clearfix")[0].getElementsByClassName("s-item__image-section")[0].getElementsByTagName("a")[0].href ; or

    2.  document.getElementsByClassName("srp-results srp-grid clearfix")[0].getElementsByClassName("s-item__image-section")[0].getElementsByClassName("s-item__image")[0].children[0].href

    I am still getting the href (image) in the browser, then why am I not able to extract it in JS / PAD

    saimrpp_0-1699452032471.png

    saimrpp_1-1699452152312.png

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Why exactly are you using JavaScript here? Why not use Extract data from web page, since your previous screenshots indicate you have been trying to capture the elements this way? That is what I was referring to.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • saimrpp Profile Picture
    37 on at

    The idea is to extract href (hyperlink) that is highlighted in you post as well. Method is not important, solution is. If you have one, please post.

  • Verified answer
    saimrpp Profile Picture
    37 on at

    Dear Community!

    After hours of research (& help from another community), found out how to extract what I needed. Here's the final Javascript&colon;

    document.getElementsByClassName("srp-river-results clearfix")[0].getElementsByTagName("a")[0].href

    If only the members in this community, simply answered, rather than "suggest".

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Great that you managed to find a solution. But if you had actually read my suggestion and used Extract data from web page, you would not have needed to spend the time figuring out why your JS script doesn't work. No idea why you kept trying to do it with JS, if the method is not important to you.

     

    Your JS will only return the first item. If you used Extract data from web page and targeted the <a> element instead of the <span>, you could retrieve the hrefs of all of the products in the page into a list.

     

    Also, please be aware that this is a voluntary community. None of the members here (apart from some Microsoft employees) are paid to do it. We all have our personal lives and our jobs. It's not like we spend 24/7 on here just so we can answer every question. Nor must we actually provide you with an actual solution that you can copy and paste into your solution. We sometimes do, but we're not always able to. So, if you can just try out the suggestions we make, it would also make your own life easier.

  • saimrpp Profile Picture
    37 on at

    Sure, but next time try giving an actual solution. People are here just for that - not "suggestions." 

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

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 211 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 190

Last 30 days Overall leaderboard