F12调试页面,如何定位参数

JQuery元素定位

1.输入"$",查看页面是否支持JQuery元素定位,如果不支持,则使用documen.querySelecttor('Input');

2.使用$('#username').length 查看元素username的个数;

F12调试页面,如何定位参数

3.使用$('input[name=lt]').val()获取到It值

F12调试页面,如何定位参数

 

4.在postman使用html界面定位到元素:

如:

const $ = cheerio.load(responseBody); //调用cheerio方法,获取到responseBody

console.log($('input[name=lt]').val());

pm.globals.set("lt", $('input[name=lt]').val());

5.cheerio方法的使用,参考:https://cheerio.js.org/这个库