在TestCafe中,类型错误:无法读取未定义的属性(读取“匹配”)。我的代码哪部分不正确?

问题描述 投票:0回答:1

getVerificationUrlFromEmailData(emailData:any){

  const emailBody = emailData.email_text;
  const urlRegex = /(https?:\/\/[^\n]*)/;
  const url = emailBody.match(urlRegex)[0];
  return url

} }

typescript testing automated-tests e2e-testing testcafe
1个回答
0
投票

根据错误信息,“emailBody”变量的值未定义。但是,我无法提出任何假设,因为您共享了自己的函数,与 TestCafe 无关。我建议您执行逐步调试以确定变量未定义的原因。如果您发现问题与 TestCafe 有关,请随时分享一个简单的可运行项目来说明该问题。

问候, 阿尔乔姆

© www.soinside.com 2019 - 2024. All rights reserved.