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

234
Vistas
How could I close with selenium a input window

I am doing a selenium automation in python and I encountered a problem. To upload a file I need the input tag but it only activates when I click over a "Upload" button, this same button opens a sepparate window that can't be managed through selenium (or at least the ways I've tried). When I close() the driver they remain open. I need to upload several files, but this window locks the interaction with the navigator, so the driver stops working.

Perhaps some way to activate input field withour opening the tab.

This is the window

this is the window

I've tried usking keys to alt F4 the window

I've tried closing al with .close()

I've tried not to click the button so the windows doesn't open but the input tag is not there unless I click.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is an idea, it worked for me with a single file, maybe it will work for you or inspire you with new ideas. Try this: First, you need your path.

 home_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))

Second, you need the path of your image and name. Lets say for example a list like this:

file_details = ["dir_name", "file_name.jpg"]

Then, you write a func:

def upload_file(self, file_name):
    self.find_element(*LOCATOR_OF_INPUT).send_keys(file_name)

And last, you call this func:

upload_file(os.path.join(home_path, os.path.join(*file_details)))

Basically, you do not click the input, you are "sending" a file to the input instead.

Best of luck, hope it helps you.

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