#๐Ÿ”’ Selenium Uploading File to Gemini AI Issue

4 messages ยท Page 1 of 1 (latest)

crimson sleet
#

I'm uploading a file to Gemini using Selenium but the problem is that when it uploads the file it only uploads a part of the file instead of the entire thing i.e. the file should not be 11 tokens.

Gemini auto-closes the iframe when the file is fully uploaded by default but when I run it through Selenium the upload is premature.

How do I make sure the entire file is uploaded?

Here's what my code looks like:

iframe_container = driver.find_element(By.CLASS_NAME, "picker-api-container")
current_iframe = iframe_container.find_element(By.TAG_NAME, "iframe")
driver.switch_to.frame(current_iframe)

file_input = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, "input")))
file_input.send_keys(os.path.abspath("/Users/Gimpy/Desktop/Documents/lessoninchem.txt"))```

https://cdn.discordapp.com/attachments/1061696544434311168/1239084308984238110/Screen_Recording_2024-05-12_at_1.06.02_AM.mp4?ex=6641a2b0&is=66405130&hm=707d2bac778463d0ba994967237809cb69cb4047ed631f4a09e5b70e0c8c3a35&

I had this idea of stopping the iframe from closing but it didn't exactly pan out. Also, tried adding implicit waits, but that didn't work either.
jade oysterBOT
#

@crimson sleet

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

jade oysterBOT
#

@crimson sleet

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.