我遇到了一种情况,我试图弄清楚如何获取在 Web 应用程序中动态生成的值。它几乎用在我一直使用的工作流程中的每个请求中。
我注意到它是基于函数中的 javascript 代码创建的,该函数类似于
function getbrowserSecurityPrint() {
var choices = {
excludes: {
'random1' = true,
'random2' = true,
'random3' = true,
'random4' = true,
'random5' = true,
'random6' = true,
}
};
var materials = {};
SecurityPrint2.get(options,functions(materials){
var values = materials.map(functions(materials) {
return materials.value;
}};
SecurityPrintToken = SecurityPrint2.x64hash128(values.join(''), 31);
brand.d.browserSecurityPrint = '{g1}' + SecurityPrintToken;
});
if (!brand.d.ServerProxy.isDestinationLocal()){
getbrowserSecurityPrint();
}
function setSecurityPrint () {
getbrowserSecurityPrint();
}
function setbrowserSecurityPrint() {
var element = document.getElementById("GOP");
if (element != null) {
document.getElementByID("GOP").value = brand.d.browserSecurityPrint;};
本质上我想要值 GOP,但我无法在任何地方找到它来关联它,因为我假设它是在源代码中生成的。
我尝试使用 JSR223 预处理器,但我陷入困境,因为我不知道如何使用它来实现我想要的
GOP
的值(无论它是什么),您可以通过在控制台中运行以下代码来使用浏览器开发人员工具进行检查:
document.getElementById("GOP")
如果它不存在 - 假设它是 null
如果该值存在,您可以使用即CSS选择器提取器
获取它关于“使用”JSR223 预处理器,有 2 个选项:
目前我们无法帮助您,因为您提供的代码不完整,例如我们不知道谁是“SecurityPrint2”。我只能建议使用 JavaScript 调试器 并逐步检查该函数,了解它在做什么、是否可行以及如何在 Groovy 中复制它。