Search code examples
robotframeworkimap

Robot Framework ImapLibrary Delete All Emails Not working


I'm using the ImapLibrary Library in Robot framework to read and verify the emails sent to the mailbox. I need to delete all the emails and keep my inbox clean for other tests. I used the Delete All Emails keyword in the library but it's not deleting any of the emails. The script looks like this

*** Settings ***
Library           ImapLibrary


*** Test Cases ***

Clear Emails
Open Mailbox    server=imap.googlemail.com   user=<MyEmail>    password=<****>
Delete All Emails

Can anyone tell me if I have done anything wrong?

PS: Email content verification is working fine.


Solution

  • If you are using https://github.com/rickypc/robotframework-imaplibrary than you should first select emails using keyword Wait For Email.

    If you are familiar with python you could check code and you will see that Delete All Emails works on self._mails variable which is populated by Wait For Email https://github.com/rickypc/robotframework-imaplibrary/blob/master/src/ImapLibrary/init.py#L103