最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

Chrome远程调试器获取JS输入值

IT培训 admin 3浏览 0评论

Chrome远程调试器获取JS输入值

我正在尝试使用Node模块“chrome-remote-interface”连接到Google Chrome调试端口。

我能够连接并拦截所有调试器消息,我可以在Websocket消息和返回值上看到我的函数,但是我无法获得函数的输入参数。

例:

{
    "callFrameId": "{\"ordinal\":0,\"injectedScriptId\":3}",
    "functionName": "capitalizeString",
    "functionLocation": {
        "scriptId": "74",
        "lineNumber": 25,
        "columnNumber": 25
    },
    "location": {
        "scriptId": "74",
        "lineNumber": 27,
        "columnNumber": 23
    },
    "url": "file:///test.html",
    "scopeChain": [
        {
            "type": "local",
            "object": {
                "type": "object",
                "className": "Object",
                "description": "Object",
                "objectId": "{\"injectedScriptId\":3,\"id\":55}"
            },
            "name": "capitalizeString",
            "startLocation": {
                "scriptId": "74",
                "lineNumber": 25,
                "columnNumber": 25
            },
            "endLocation": {
                "scriptId": "74",
                "lineNumber": 28,
                "columnNumber": 1
            }
        },
        {
            "type": "global",
            "object": {
                "type": "object",
                "className": "Window",
                "description": "Window",
                "objectId": "{\"injectedScriptId\":3,\"id\":56}"
            }
        }
    ],
    "this": {
        "type": "object",
        "className": "Window",
        "description": "Window",
        "objectId": "{\"injectedScriptId\":3,\"id\":57}"
    },
    "returnValue": {
        "type": "string",
        "value": "ANOMBRE"
    }
}

谁知道如何使用“chrome-remote-interface”获取JS函数的输入值?

回答如下:

解决了。我必须使用“Runtime.getProperties”来获取具有该字段值的Promise。

Chrome远程调试器获取JS输入值

我正在尝试使用Node模块“chrome-remote-interface”连接到Google Chrome调试端口。

我能够连接并拦截所有调试器消息,我可以在Websocket消息和返回值上看到我的函数,但是我无法获得函数的输入参数。

例:

{
    "callFrameId": "{\"ordinal\":0,\"injectedScriptId\":3}",
    "functionName": "capitalizeString",
    "functionLocation": {
        "scriptId": "74",
        "lineNumber": 25,
        "columnNumber": 25
    },
    "location": {
        "scriptId": "74",
        "lineNumber": 27,
        "columnNumber": 23
    },
    "url": "file:///test.html",
    "scopeChain": [
        {
            "type": "local",
            "object": {
                "type": "object",
                "className": "Object",
                "description": "Object",
                "objectId": "{\"injectedScriptId\":3,\"id\":55}"
            },
            "name": "capitalizeString",
            "startLocation": {
                "scriptId": "74",
                "lineNumber": 25,
                "columnNumber": 25
            },
            "endLocation": {
                "scriptId": "74",
                "lineNumber": 28,
                "columnNumber": 1
            }
        },
        {
            "type": "global",
            "object": {
                "type": "object",
                "className": "Window",
                "description": "Window",
                "objectId": "{\"injectedScriptId\":3,\"id\":56}"
            }
        }
    ],
    "this": {
        "type": "object",
        "className": "Window",
        "description": "Window",
        "objectId": "{\"injectedScriptId\":3,\"id\":57}"
    },
    "returnValue": {
        "type": "string",
        "value": "ANOMBRE"
    }
}

谁知道如何使用“chrome-remote-interface”获取JS函数的输入值?

回答如下:

解决了。我必须使用“Runtime.getProperties”来获取具有该字段值的Promise。

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论