能否以编程方式复制浏览器控制台中的 属性 搜索功能?

Can the property search function in a browser's console be replicated programatically?

在浏览器开发工具控制台中,您可以搜索内容。 在本例中,它是保存在脚本变量中的一些信息,格式为 JSON。

所以我有一些问题: 1 - 有没有办法在 javascript 中复制此控制台搜索? 2 - 这些信息实际保存在哪里,是在内存中吗? JSON 中的一些详细信息已在页面加载后 javascript 秒更新,它不再是您可以从页面源 HTML.[=12= 获得的相同版本]

您可以尝试使用 Proxy 对象来监视(和拦截)对该对象所做的更改。

digitalData = new Proxy(digitalData, {  
  set: function (target, key, value) {
    target[key] = value;
    // updated object
    console.log({ target });
    return true;
  }
);

我已经通过使用适当的浏览器文档实现了这一点 window;

function GetDocWindow()
{  
  var document, window;
  document = Sys.Browser().Page("*").contentDocument
  // Check if the document.parentWindow property is available
  if (aqObject.IsSupported(document, "parentWindow")){
    window = document.parentWindow //ie browser
    Log.Message("Document type in use is 'parentWindow'")
    }

  // Check if the document.defaultView property is available
  else if (aqObject.IsSupported(document, "defaultView")){
    window = document.defaultView //chrome browser
    Log.Message("Document type in use is 'defaultView'")  
    }
  else
    Log.Error("Unknown browser that doesn't support document.parentWindow or document.defaultView.");
  
  return window
}

“aqObject”是 smartbear 的 testComplete 软件的原生软件,但希望这对任何正在寻找类似问题的人有所帮助,因为我很难得到这个答案。