Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!