Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda