我想提交一个包含POST数据(参数)的表格;该怎么做?
Dictionary<string, string> postData = new Dictionary<string, string>();
postData.Add("p1", "value1");
postData.Add("p2", "value2");
postData.Add("p3", "value3");
var postDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
await _page.SetRequestInterceptionAsync(true);
_page.Request += async (sender, e) =>
{
if (e.Request.Url == "http://test.com/postPage")
{
var payload = new Payload()
{
Method = HttpMethod.Post,
PostData = postDataJson // HERE
};
await e.Request.ContinueAsync(payload);
}
else
{
await e.Request.ContinueAsync();
}
};
await _page.ClickAsync("#filterBtn");
执行,达到IF条件,并且有效负载填充数据(// HERE); ContinuteAsync(payload)之后,请求中没有发送POST数据。
我希望在发送请求中看到postDataJson,但是没有。