Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
GetElements from a URL with powershell

I am trying to get all links for each object, in order to make a log of which items are new and which are old

I dont understand how to grab links from a shopping website...

Tis is the code that works.

$URI = 'http://superwidgets.wordpress.com/category/sql/'
$HTML = Invoke-WebRequest -Uri $URI
($HTML.ParsedHtml.getElementsByTagName('h2') | Where{ $_.className -eq 'entry-title' } )

(Ref: https://social.technet.microsoft.com/wiki/contents/articles/26009.getting-information-from-web-pages-via-powershell.aspx )

This code does not

$url = 'https://www.norrona.com/nb-NO/o/herre/?displaysize=L%7CM&s=7&h=69000'
$x = Invoke-WebRequest -Uri $URL
($x.ParsedHtml.getElementsByTagName('div') | Where{ $_.className -eq 'productcard' } )

WHY?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This works but there is no div element with a productcard classname. Html and Javascript are just a bunch of text that are not rendered by any browser when retrieved from PowerShell. This means all the javascript is not executed.

There is a <script> element that is:

<script src="/api/translation/JavascriptInject?groups=Global&amp;groups=ProductList&amp;groups=Product&amp;groups=Payment&amp;groups=PrePurchase"></script>
<main id="vueProductList" role="main">
</main>

that probably should be invoked to render the elements you look for. But this is another call to another web ressource that probably return javascript objects. This doesn't tell if the objects would be styled with a productcard CSS class when rendered by javascript code.

This is probably not the right way to get the product list. You should directly access the API (if available) to get the list of products. You can then use PowerShell to convert json to powershell objects with ConvertFrom-Json cmdlet.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!