问题解决了
我有一个在 Visual Studio 2012 中运行的编码 webtest 文件。在其中一个 Web 请求中,当我单击“响应”选项卡时,有标题和正文。
我的问题是如何从 C# 中的 Body 中提取信息?我需要使用下一个 WebTestRequest 中的信息
编辑:我刚才尝试了这种方法:
string test = "";
request23.ExtractValues += (d, e) =>
{
WebTestResponse haha = e.Response;
test = haha.BodyString.ToString();
test = Regex.Replace(test, @"\D", ""); //remove any non-digits coz I need the ID
};
它有效,我得到了我想要的价值。但后来我再次运行它,它只返回空字符串。[编辑]:重新启动 Visual Studio 并再次工作