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

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

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 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