【问题标题】:Using Chrome remote debugging for sending 'Enter' key使用 Chrome 远程调试发送“Enter”键
【发布时间】:2014-03-24 19:27:33
【问题描述】:

我在 Chrome 扩展中使用 Chrome 远程调试协议是为了将键盘事件发送到页面。这对于标准输入效果很好,但我找不到要传递的正确参数以创建“Enter”键事件。我在 Windows 上工作。 这是协议的链接: https://developers.google.com/chrome-developer-tools/docs/protocol/1.1/input

我知道我可以使用纯 JavaScript 和 KeyboardEvent(在内容脚本中)来完成,但这不是满足我需求的有效解决方案。 有人做过并成功了吗?

谢谢

【问题讨论】:

    标签: google-chrome-extension google-chrome-devtools google-chrome-app


    【解决方案1】:

    好的,我想通了... 以下是应该发送的事件:

    {
        "type" : "rawKeyDown",
        "windowsVirtualKeyCode" : 13,
        "unmodifiedText" : "\r",//This is the critical part
        "text" : "\r" //This is the critical part
    }
    

    然后是 type = "char" 和 "keyUp" 的相同事件。

    希望这会对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2012-09-08
      • 2014-07-17
      • 2017-12-29
      • 1970-01-01
      • 2014-12-25
      • 2015-07-05
      • 2013-12-28
      • 2014-06-13
      • 1970-01-01
      相关资源
      最近更新 更多