Skip to content Skip to sidebar Skip to footer

How To Obtain Received Message From "facebook Messages" Page Using Selenium?

I am trying to write a Python program which will fetch the last message from a person from facebook messages page(similar to facebook messenger) as soon as he texts and print it in

Solution 1:

Your problem will be solved by follwing below steps.

  1. Switch to frame driver.switch_to_frame("//iframe[contains(@src,'userid')]") (Note : Here 'userid' is chat username.)
  2. Use this XPath //div[@data-hover='tooltip']/div[@role='img'] to identify the facebook smilies or GIF images.
  3. Use this XPath //div[@data-hover='tooltip']/div/span to read the chat text.

Post a Comment for "How To Obtain Received Message From "facebook Messages" Page Using Selenium?"