想问一下,selenium怎么获取到载荷(payload)信息 写的注入js
js.executeScript(
"window.requestPayloads = [];" +
"var originalFetch = window.fetch;" +
"window.fetch = function() {" +
" var args = arguments;" +
" console.log(args);" +
" if (args && args.method === 'POST' && args.body) {" +
" var clone = args.body.clone();" +
" clone.text().then(function(bodyText) {" +
" window.requestPayloads.push(bodyText);" +
" });" +
" }" +
" return originalFetch.apply(this, arguments);" +
"};" +
"var open = XMLHttpRequest.prototype.open;" +
"XMLHttpRequest.prototype.open = function(method, url) {" +
" this._method = method;" +
" this._url = url;" +
" open.apply(this, arguments);" +
"};" +
"var send = XMLHttpRequest.prototype.send;" +
"XMLHttpRequest.prototype.send = function(body) {" +
" if (this._method === 'POST' && body) {" +
" window.requestPayloads.push(body);" +
" }" +
" send.apply(this, arguments);" +
"};"
有时候能查到,有时候查不到,公司selenium 没有DevTools类 求助