【问题标题】:chromedp fails to start a new instance of chromechromedp 无法启动新的 chrome 实例
【发布时间】:2020-12-29 23:54:26
【问题描述】:

大家好,我一直在尝试使用 chromedp 在我的浏览器机器上自动执行一项任务。

我在 repo 上尝试了示例,但它们总是失败:

意外故障地址0x7f7a36461000致命错误:故障[信号SIGBUS:总线错误代码=0x2 addr=0x7f7a36461000 pc=0x53a9d5]

正在运行的示例源代码可以在here找到。

据我了解,chromedp 带有 chrome 的无头预编译版本。我浏览了 API 文档,看看是否可以传递开发工具正在侦听的端口,但没有成功。

但是,当我尝试 mafredri/cdp 时,它起作用了。我开始了解到 chromedp 无法启动其嵌入式 chrome。虽然,我不太确定。为什么会这样?

我的环境:

谷歌浏览器 85.0.4183.102

Ubuntu 18.04.4 LTS

go 版本 go1.13.5 linux/amd64

任何帮助将不胜感激。

【问题讨论】:

    标签: go chrome-devtools-protocol chromedp


    【解决方案1】:

    所以,长话短说,我通过go test 对本地安装的 chromedp 库进行了测试,但失败了。我打开了an issue on the Github repo。虽然没有表明它需要 Go 1.14+,但确实需要。

    如果您遇到此问题,请先在 master 分支本地安装的库上运行测试。如果失败并显示以下日志:

    github.com/chromedp/chromedp [github.com/chromedp/chromedp.test] ./chromedp_test.go:862:3: t.Cleanup undefined (type *testing.T has no 字段或方法清理)./chromedp_test.go:948:5: t.Cleanup undefined (类型 *testing.T 没有字段或方法清理) ./chromedp_test.go:950:5: t.Cleanup undefined (type *testing.T has no 字段或方法清理)失败 github.com/chromedp/chromedp [build 失败]

    您需要知道 t.Cleanup 是在 Go 1.14 上添加的(感谢 Oiyoo)。

    如果您遇到同样的问题,我希望这对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 1970-01-01
      • 2022-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多