Reputation: 81
So i have a code which logins to Facebook and fills everything needed to publish an item in marketplace, but I've been struggling in uploading images. First of all there is no input tag inside the 'parent tag' (div class="aov4n071") (the first div):
However when i try this line of code:
ele = wait.until(EC.presence_of_element_located((By.XPATH,'//*[contains(text(), "Añadir fotos")]')))
ele.click()
The element does get clicked without any error, and the dialog where you need to browse your folder manually shows up. AS EXPECTED. However when i send_keys() to ele it shows:
selenium.common.exceptions.ElementNotInteractableException: Message: Element <span class="a8c37x1j ni8dbmo4 stjgntxs l9j0dhe7 ltmttdrg g0qnabr5 oi732d6d ik7dh3pa d2edcug0 qv66sw1b c1et5uql muag1w35 ew0dbk1b jq4qci2q a3bd9o3v lrazzd5p oo9gr5id"> is not reachable by keyboard
Which is understandable because it is not an input element. But where the hell is the input tag??
I found out that there are two input classes that are right above the 'parent' class i talked about in the first picture. But these elements are not like the others, when i put my cursor on them, they don't behave like the other elements. It seems like they are invisible. (look how they are not colored like the other ones)
I tried this line of code:
ele = wait.until(EC.presence_of_element_located((By.CLASS_NAME,'mkhogb32')))
ele.send_keys(var)
But it gives me this error:
selenium.common.exceptions.ElementNotInteractableException: Message: Element <div class="eopy0mj9 ina5je9e kr520xx4 j9ispegn poy2od1o b5wmifdl mw227v9j n7fi1qx3 dya21fl7 a47luoao sbevj9st ev399l9o iwynql29 kuz35qqg mkhogb32"> is not reachable by keyboard
But when i try this:
ele.click()
I get the following error:
selenium.common.exceptions.ElementNotInteractableException: Message: Element <div class="eopy0mj9 ina5je9e kr520xx4 j9ispegn poy2od1o b5wmifdl mw227v9j n7fi1qx3 dya21fl7 a47luoao sbevj9st ev399l9o iwynql29 kuz35qqg mkhogb32"> could not be scrolled into view
I don't know much about HTML but i can tell these are the tags that will allow me to upload pictures, but why do the behave different?
What can i do do finally upload pictures?
Are the input tags in another frame?
Upvotes: 0
Views: 208
Reputation: 11
this code is running good
POST="c:\\maphoto.jpg"
l=navigateur.find_elements_by_tag_name('input')
for g in l:
if g==navigateur.find_element_by_xpath("//input[@type='file'][@class='mkhogb32']"):
g.send_keys(POST)
time.sleep(5)
Upvotes: 1