When a file arrived either txt or pdf I would get the error of:
AttributeError: 'Message' object has no attribute 'save_media
I noticed that when the "type" of the message comes as "document" the "isMedia" field comes as false so in the "factory_message" function I changed it to include the document as media.
"""Factory function for creating appropriate object given selenium JS object"""
#print("ok",js_obj)
#print("dir",dir(js_obj))
if js_obj is None:
return
if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]:
return GeoMessage(js_obj, driver)
if js_obj["isMedia"] or js_obj["type"] == 'document':
return MediaMessage(js_obj, driver)
if js_obj["isNotification"]:
return NotificationMessage(js_obj, driver)
if 'isMMS' in js_obj and js_obj["isMMS"]:
return MMSMessage(js_obj, driver)
if js_obj["type"] in ["vcard", "multi_vcard"]:
return VCardMessage(js_obj, driver)
return Message(js_obj, driver)```
When a file arrived either txt or pdf I would get the error of:
AttributeError: 'Message' object has no attribute 'save_media
I noticed that when the "type" of the message comes as "document" the "isMedia" field comes as false so in the "factory_message" function I changed it to include the document as media.