Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
Selenium Explicit/Fluent wait until service worker is installed

I am working on a selenium script to visit a list of websites that install service workers. What I want to do is, if selenium visits a website, it should wait for the service worker to be installed before moving on to the next website or quitting the selenium driver. Currently, my code looks like the following.

        for url in tqdm(list_urls):
            driver = get_driver() # gets driver from helper function.
            print(f'Doing {url} {list_urls.index(url)+1}/{len(list_urls)}')
            try:
                driver.get(url)
                sleep(10) # probably not the best way to do it.
            
            except: # if there is a selenium timeout exception.
                print(f'{url} did not work ... will try again.')
                repeat_list.append(url)
        
            driver.quit()

I have a sleep(10) which I do not think is the best way to do it. There is a possibility that the service worker is installed in 1 second (it sits idle for 9 seconds doing nothing) or the service worker was not installed in 10 seconds. I am going to do this for a list of websites at the scale of thousands. I understand there are implicit, explicit, and fluent wait statements in selenium but I have not found anything that is useful for me.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda