【问题标题】:chrome har file generationchrome har 文件生成
【发布时间】:2015-11-22 15:00:38
【问题描述】:

我目前正在使用 phantomjs 来生成 HAR 文件。但它有时会挂断,因此我正在尝试使用 Chrome 来做到这一点。我安装了它并安装了chrome-har-capturer 来为我完成这项工作。

但是当我尝试执行时

chrome-har-capturer -o out.har https://github.com

这句话是假的

cannot connect to chrome
error : connect ECONNREFUSED

谁能告诉我我缺少什么...我在 centos(64)VPS 和 chrome 最新稳定版本

【问题讨论】:

    标签: google-chrome centos har


    【解决方案1】:

    根据我的经验,我认为问题在于 Chrome 无法正常打开。由于您使用的是 VPS,它没有窗口环境,因此您还需要确保安装了 Xvfb 以提供虚拟视觉缓冲区。您可以使用

    yum install xorg-x11-server-Xvfb
    

    然后使用

    xvfb-run google-chrome --remote-debugging-port=9222 > /dev/null & 
    

    应该在后台启动 google chrome。如果一切正常,那么现在使用命令捕获 har 文件应该没有问题。

    要确保 chrome 正在运行,请使用

    ps -aux|grep google-chrome
    

    chrome运行正常后就可以使用了

    chrome-har-capturer -o out.har https://github.com
    

    【讨论】:

    • 仍然无法连接到 chrome 错误:连接 ECONNREFUSED
    • 参考this 问题,您可能需要更新您的节点。
    猜你喜欢
    • 2018-06-16
    • 2012-11-12
    • 2012-05-20
    • 2021-04-17
    • 2017-06-15
    • 2018-11-06
    • 2018-05-05
    • 2018-09-18
    • 2015-01-02
    相关资源
    最近更新 更多