Home > Software design >  Direct Message Selenium Instagram
Direct Message Selenium Instagram

Time:05-25

all trust that you're well I'm trying to inspect the textarea of the Instagram Direct Message section using selenium, however, my attempts in finding the path have been unsuccessful, would appreciate any help I can get.

enter image description here

txt_box = bot.find_element_by_xpath('/html/body/div[1]/section/div/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div/div[2]/textarea')
        txt_box.send_keys(f"Hey @{user}")  # Customize your message

Error I receive upon running the code:

 txt_box = bot.find_element_by_xpath('//textarea[@placeholder="Message..."]')
Exception in thread Test 1:
Traceback (most recent call last):
  File "C:\Users\veron.000\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\veron.000\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "c:\Users\veron.000\Desktop\Eros\Instagram\Instgram Dm v1\Final\Multi_Dm.py", line 83, in test_instance
    send_msg(usrnamee)
  File "c:\Users\veron.000\Desktop\Eros\Instagram\Instgram Dm v1\Final\Multi_Dm.py", line 73, in send_msg
    txt_box.send_keys(f"Hey @{user}, I'm Jordan from ARICCI’s Talent Recruitment in London.\nWe’re an upcoming sunglasses brand and we would love to see you in our new pieces!\n\nWould you be down for promoting us and earning FREE products, BIG commissions, and getting featured on our official Instagram page?\n\n           
  • Related