0

My script is to open mailbox and delete all the emails.

Open Mailbox    host=outlook.office365.com  user=username   password=pass
${count}=   Wait For Email      
Delete All Emails           
Close Mailbox

If count returns value, the script works. But if no email in the mailbox, the keyword "Wait For Email" returns error: "No email received within 60s". Test case fails.

Can you help me ignore the failed error when no email in the mailbox? Tks a lot.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
Minh
  • 21
  • 1
  • 5
  • 1
    You shouldn't be calling `wait for email` if you don't actually want to wait for email to arrive. – Bryan Oakley Jun 08 '18 at 12:28
  • But if I don't use "wait for mail", the test case is always passed although no mails are deleted. I think may be the script runs so fast that it can't handle deleting all mails. – Minh Jun 11 '18 at 02:24
  • The `run keyword and ignore error wait for email timeout=1 poll_frequency=1` could be used to handle case when the mailbox is empty. And nevertheless, an exception was thrown inside the deletion will be successful. – Sam Maksymyshyn Jul 21 '23 at 16:12

0 Answers0