Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97807

Python selenium, upload picture using chromedriver

$
0
0

I am working on a project to upload a picture on my facebook page using python selenium. I open the browser using selenium, login, open my page, click the upload button. At this point, a windows file browser pops up and prompts me to enter filename.

The code snippet which clicks on the Upload button and opens the file browser is:

WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'a._3m1z'))).click()

However, after doing some research, I found that I can use the send_keys function to provide the path to the webdriver for the file. The code for this should be:

WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'a._3m1z'))).send_keys("a.jpg")

However, this line (with the send keys option gives an error:

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

The HTML for the page is as follows (highlighted is the button I want to press and give the file path to)

Can someone tell me whats going on, and how do I give the image path to the webdriver?

I am using python 3.7

enter image description here


Viewing all articles
Browse latest Browse all 97807

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>