Sebastian Nielsen Sebastian Nielsen - 25 days ago 10
HTML Question

python selenium - uploading pic, when library appear - cant press enter

There is a website where i gotta press a button and then upload a pic.
When I press the button, my personal library will appear, and I will then have to choose the path for my picture.

Here is my code I tried:

from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from time import sleep

upload = browser.find_element_by_id('uploadButton')
upload.click()
upload.send_keys('C:\\Users\\sebastian\\Desktop\\pictures\\1757.jpg')
upload.send_keys(Keys.ENTER)


Here is my problem:
It goes into my library pastes the path to my picture perfectly. But then!
Its like it doesnt press enter, or maybe it cant accept an enter? I dont know.
But it just stays there. And no error appeares on the output.

Not duplicate: he had his problem poorly explained. As well as his picture/screenshot is broken. Even though the same answer fixed both of our questions, our questions was a little diffrent told.

Answer

Seems like a typo mistake. its send_keys not sendKeys. Correct it to upload.send_keys(Keys.ENTER)