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

163
Visualizações
Trigger some JavaScript function with selenium on a webpage to load new elements

I'm trying to get some data from a webpage:

https://www.cabotcorp.com/solutions#product-index

On this webpage, whenever you scroll down to the end, it takes a couple of seconds and then loads a new set of items.

When that happens something gets added to the HTML which I want to look at with selenium in python.

So my question is pretty general:

Is there a way to force the function that loads the new elements?

My first idea is as follows:

driver.execute_script("arguments[0].scrollIntoView();", driver.find_element(By.CLASS_NAME, "some class at the bottom of the page"))

This is the code I would use to let selenium scroll down to some element on the webpage. After that I would just sleep for a set amount of time to assure that the new elements loaded in.

However, I noticed that this webpage uses "ddscrollspy"

https://github.com/dynamicdriverepo/ddscrollspy

Is there a way to use selenium to trigger a new set of items? I'm basically looking for a function that triggers certain Javascripts that are available on a certain webpage.

Edit:

A friend suggested looking for triggers:

This is what I found in Chrome:

enter image description here

So I now have access to the code that gets executed whenever something new loads. Now I just need to know how to trigger that code on demand.

Thanks for the help.

about 4 years ago · Juan Pablo Isaza
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