前端测试分析需要测试百度以及在登录百度账号之后捕捉post,但是如图操作之后没有显示post,请问是什么问题呀


前端测试分析需要测试百度以及在登录百度账号之后捕捉post,但是如图操作之后没有显示post,请问是什么问题呀


关注让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言问题描述:通过浏览器的调试工具测试百度网页,在登录百度账号后想要捕捉post请求,但是没有显示post请求信息。 解决步骤:
var xhr = new XMLHttpRequest();
var url = "https://www.baidu.com/register";
var params = "email=test@example.com&password=123456";
xhr.open("POST", url, true);
//Send the proper header information along with the request
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {//Call a function when the state changes.
if(xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
}
}
xhr.send(params);
在调试工具的网络请求面板中可以看到该请求的请求方式为POST,请求参数为email和password,并且可以查看到服务器返回的响应结果。如果在调试工具中无法看到该请求,则需要检查以上列出的步骤。