51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

无法使用Cypress-Mailosaur捕获电子邮件正文。

英文:

Unable to catch email body with Cypress-Mailosaur

问题 {#heading}

这是电子邮件。它是HTML格式的,我正在尝试提取代码。

我得到了这个错误。

我只是添加了一个断言来检查我是否获取了电子邮件的正文,但错误显示为空白。 英文:

This the email. It is in HTML and I am trying to retrieve the code
无法使用Cypress-Mailosaur捕获电子邮件正文。

I am getting this
无法使用Cypress-Mailosaur捕获电子邮件正文。

I just put an assertion just to check if I am getting the body of the email but the error says it's ''

答案1 {#1}

得分: 1

电子邮件通常分为两部分,一个是HTML部分,另一个是文本部分。这是为了在您在不支持HTML的设备上阅读电子邮件时(这种情况已经很少见了),可以显示文本版本。

回答您的问题:您需要更改您的代码,使用email.html.body而不是email.text.body,因为您没有电子邮件的文本版本。

您应该能够通过email.html.codes[0]来检索您的认证代码。 英文:

Emails typically have two parts, an html part and a text part. This is so that when you are reading an email on a device that doesn't support html (rare these days) the text version can be shown.

To answer your question: you need to change your code to use email.html.body rather than email.text.body as you don't have a text version of your email.

You should be able to retrieve your authentication code via email.html.codes[0] as well.


赞(3)
未经允许不得转载:工具盒子 » 无法使用Cypress-Mailosaur捕获电子邮件正文。