如何调试在Chromebox上运行的Kiosk Chrome应用程序?

时间:2014-12-12 13:43:30

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

我写的Chrome Kiosk应用程序仅在Chromebox上以Kiosk模式运行时才会出现问题。在我登录Chromebox后手动启动应用程序时,它运行良好。此外,在我的开发机器上测试应用程序时,一切运行良好。

如何附加远程调试会话,编写远程日志记录信息或以任何其他方式从Chromebox上的Kiosk应用程序获取调试信息到我的开发机器?

3 个答案:

答案 0 :(得分:14)

如果您使用--remote-debugging-port = 9222选项运行Chrome,它将在http://localhost:9222/处提供对DevTools的访问权限。现在,在以Kiosk模式运行的Chromebox上,如果没有一些额外的步骤,那就不是那么有用(甚至可能):

  1. 将您的设备置于"开发者模式"。说明因on hardware model而异。
  2. Make the file system writable,以便您可以修改chrome的命令行参数。
  3. 添加" - remote-debugging-port = 9222"到/etc/chrome_dev.conf
  4. killall chrome以便命令行更改生效。
  5. 使用ssh登录Chromebox并在本地转发端口:ssh -L9222:127.0.0.1:9222 chronos@<chromebox ip>
  6. http://localhost:9222/
  7. 访问本地计算机上的DevTools

    鉴于所有这些,如果您可以在非自助服务终端模式下解压缩,则可以更轻松地调试自助服务终端应用。

答案 1 :(得分:1)

为了将来节省其他时间,我发现在尝试调试以kiosk模式运行的应用程序时,您不需要作为chronos用户进行ssh。

事实上,我发现当设备在非托管信息亭模式下运行应用程序时,我无法作为chronos用户进行ssh,但是,我可以在登录操作系统时使用。

相反,我必须以root用户身份进行ssh。然后,我可以按照Reilly Grant的记录设置隧道,并通过localhost:9222连接到远程调试器。

这意味着您需要对Reilly Grant的说明进行的唯一更改是在步骤5中将ssh -L9222:127.0.0.1:9222 chronos@<chromebox ip>更改为ssh -L9222:127.0.0.1:9222 root@<chromebox ip>

答案 2 :(得分:0)

我知道这应该是一条评论,但我现在是49人。对于那些尝试使用最新版本的chrome的人,您很可能最终会遇到无法正常使用的远程控制台的问题。要解决此问题,您必须打开本地调试器,然后在其控制台中输入以下内容:(参考:https://github.com/Adobe-CEP/CEP-Resources/issues/78

isEnterKey = function(event){
  return event.key ==  'Enter' && event.keyCode == 13;
};

Object.defineProperty(KeyboardEvent.prototype, 'keyIdentifier', {
    get: function() {
        switch (this.key) {
            case "ArrowDown":
                return "Down";
            case "ArrowLeft":
                return "Left";
            case "ArrowRight":
                return "Right";
            case "ArrowUp":
                return "Up";
            case "Escape":
                return "U+001B";
            case "Tab":
                return "U+0009";
            default:
                return this.key;
        } 
    }
});