You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在RSelenium中指定路径使用Google Chrome Beta

RSelenium指定Chrome安装路径(启动Beta版)实现方法

RSelenium中没有单独暴露chrome_options.binary_location的同名参数,等效配置通过rsDriver的extraCapabilities传入即可,具体操作步骤如下:

1. 提前确认两个关键路径

  • Chrome Beta可执行文件路径:不同系统默认路径参考
    • Windows:C:\Program Files\Google\Chrome Beta\Application\chrome.exe
    • macOS:/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta
    • Linux:/usr/bin/google-chrome-beta
      自定义安装的话直接替换成你的实际安装路径即可。
  • 对应版本chromedriver路径:必须下载和Chrome Beta大版本完全匹配的chromedriver,版本不匹配会直接启动失败,将下载好的驱动存到本地任意可访问路径即可。

2. 启动代码示例

library(RSelenium)

# 替换为你本地的实际路径
chrome_beta_path <- "C:\\Program Files\\Google\\Chrome Beta\\Application\\chrome.exe"
chromedriver_path <- "C:\\tools\\chromedriver-beta\\chromedriver.exe"

# 初始化驱动
driver <- rsDriver(
  browser = "chrome",
  # 手动指定驱动路径时可以把chromever设为NULL,跳过自动版本检测
  chromever = NULL,
  extraCapabilities = list(
    chromeOptions = list(
      binary = chrome_beta_path, # 该参数等效于其他语言绑定里的binary_location
      args = list(
        "--no-sandbox",
        "--start-maximized"
        # 其他需要的启动参数按格式追加在这里即可
      )
    )
  )
)

# 连接客户端测试
remDr <- driver$client
remDr$navigate("https://example.com")

常见问题排查

  • macOS/Linux启动报权限错误时,先在终端执行chmod +x 你的chromedriver完整路径给驱动加执行权限
  • Windows启动被系统拦截时,允许chromedriver和Chrome Beta的网络访问权限即可
  • 启动闪退/报错优先核对Chrome Beta和chromedriver的大版本号,版本不匹配是最高发的问题

内容的提问来源于stack exchange,提问作者user2554330

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.28 17:18:19