pythonemailrobotframeworkimaplibrobotframework-browser

How to use functions properly Robotframework IMAP library


this is my first post (not native English) :)

I would like to use "Get Multipart Field Names". This function has a return value, but I can not give an argument which email (index) should be used. The documentation has few information without a proper example. I tried many things. But I think this is my closest attempt: @{fields} Get Multipart Field Names

I always get the error: Suspended due to logged failure: AttributeError: 'NoneType' object has no attribute 'keys'

This is the function

    def get_multipart_field_names(self):
        """Returns all available header field names of selected multipart email message.

        Examples:
        | Get Multipart Field Names |
        """
        return list(self._mp_msg.keys())

When I hover over "keys()" it says: "(function) keys: Any"

I just want to have the encoded email body, so I can decrypt some words of it myself.


Solution

  • Probably keyword walk Multipart Email was not called prior to Get Multipart Field Names.

    The probable order of keywords for your case could be :

    1. Open Mailbox ...
    2. ${mail_index} = wait for email ... - searching for email by status/subject etc
    3. walk Multipart Email ${mail_index} - creating some internal objects being necessary for other multipart keywords!
    4. ${field_names} = Get Multipart Field Names - should work now.