我正在使用带有selenium2library的Robot-framework来测试一些web应用程序。该脚本登录并向某些电子邮件发送激活URL。我使用ImapLibrary来捕获邮件并将其读出来,但我得到了以下错误。
失败:LookupError:未知编码:text / html
有人可以帮助我。
以下是我使用的脚本
*** Settings ***
Library ImapLibrary
*** Test Cases ***
Email Verification
Open Mailbox host=imap.domain.com user=email@domain.com password=secret
${LATEST} = Wait For Email sender=noreply@domain.com timeout=300
${HTML} = Open Link From Email ${LATEST}
Should Contain ${HTML} Your email address has been updated
Close Mailbox
Multipart Email Verification
Open Mailbox host=imap.domain.com user=email@domain.com password=secret
${LATEST} = Wait For Email sender=noreply@domain.com timeout=300
${parts} = Walk Multipart Email ${LATEST}
:FOR ${i} IN RANGE ${parts}
\\ Walk Multipart Email ${LATEST}
\\ ${content-type} = Get Multipart Content Type
\\ Continue For Loop If '${content-type}' != 'text/html'
\\ ${payload} = Get Multipart Payload decode=True
\\ Should Contain ${payload} your email
\\ ${HTML} = Open Link From Email ${LATEST}
\\ Should Contain ${HTML} Your email
Close Mailbox
答案 0 :(得分:0)
此分叉:https://pypi.org/project/robotframework-imaplibrary2/解决了该问题。如果您尚未找到解决方案,则应将其解决:)
答案 1 :(得分:0)
在我公司,我们使用 mailosaur library to test our email from our Robot Framework tests。我们在每次测试中使用不同的电子邮件地址。
我们也使用 Mailosaur 进行 SMS 测试,但在使用 Cypress 的不同测试套件中