Search code examples
robotframeworkimaplib

ImapLibrary- Robot Framework: How to check total of mail inbox or check when no email in mailbox


Currently, I use a robot framework-ImapLibrary for open mail to check context mail, then I have a function to click "Don't Send email", So How to check mail in the mailbox that actually I don't recieve an email.

Thanks for your help in advance!


Solution

  • You can use these keywords to check if email is not sent after executing "Don't send email" function.

    Run Keyword And Expect Error    Some Error    Wait For Email    sender=noreply@domain.com  folder=INBOX  subject=Some Subject
    

    P.S. Replace "Some Error" with error what is returned from Wait For Email keyword. Make sure you have Open Mailbox before using above keyword.