0

I am writing a script to automate chatting and sending of images through facebook messenger (business suite in particular).

Below is my code, upon executing it I'll get a element not interactable error

img_path = 'C:/Users/eugen/Downloads/HOTM.png'
file_input = driver.find_element_by_xpath('/html/body/div[1]/div[1]/div/div/div[1]/div/div/div/div/div/div/div/div/div/div[1]/div[2]/div/div[1]/div/div/div/div/div[1]/div[2]/div/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/div[1]/div/form/input')
file_input.send_keys(img_path)

I think its because in the page source input type='hidden', as shown below

https://i.stack.imgur.com/oasst.png

I have also tried changing type to 'file' using

value = driver.execute_script("arguments[0].type='file' ;", file_input)

However I am still unable to attach anything and instead get this

https://i.stack.imgur.com/uYRWk.png

Does anyone have any suggestions ? Thanks

Eugene
  • 1
  • 1
  • Any help from here? Seems your usage of "execute_script" is not valid. https://stackoverflow.com/questions/19079040/selenium-python-how-to-insert-value-on-a-hidden-input – pullidea-dev May 17 '21 at 09:23
  • You are aware Facebook does not allow it and the divs you checking for will change at any moment which will break your script. And because Facebook doesn't allow you they may ban you. – WizKid May 17 '21 at 16:07

0 Answers0