I am working on a browser automation project in Python using selenium. I am trying to upload a picture to a page. I login, go to the page, and click the upload button. After clicking the upload button, a windows file browser opens up, where I have to select the file path and hit the open button on the windows browser. I am looking to automate this process. Following is an image of whats going on, to clarify:
Now, I want to give the file path and click the open button. To click the "Upload Photos" button, I use the following line of code:
browser.find_element_by_css_selector("a._3m1z").click()
I searched the internet, and came across the send_keys function. I tried the following:
browser.find_element_by_css_selector("a._3m1z").send_keys(os.getcwd()+"/image.png")
I get the following errors:
File "C:\Users\Umar\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=79.0.3945.88)
Can someone point what is going wrong and point me in the right direction? I am using python 3.7
