是否可以在 chromote 中包含 JavaScript 库?

问题描述 投票:0回答:1

使用

phantomJS
可以通过执行
page.inject("thelibrary.js")
来包含 JavaScript 库。可以使用 chromote 包吗?我在文档中没有找到任何内容。

javascript r phantomjs chromote
1个回答
0
投票

一个人就能做到

      chrm <- Chrome$new(
        path = chromePath,
        args = "--disable-gpu --headless --remote-debugging-port=9222"
      )
      chromote <- Chromote$new(browser = chrm)
      session  <- ChromoteSession$new(parent = chromote)
      ids <- session$Page$navigate("about:blank")
      jsfile <- "path/to/jslibrary"
      library <- paste0(readLines(jsfile), collapse = "\n")
      . <- session$Runtime$evaluate(library)
© www.soinside.com 2019 - 2024. All rights reserved.