R中chromote报错:已有LiveHTML对象时创建新对象提示仅能为新窗口设目标位置
Chrome 134 与 chromote 0.4.0 兼容性冲突:多 LiveHTML 对象创建失败报错
-32602 问题表现
当已有LiveHTML对象存在时,创建新对象或调用已有对象的initialize()方法会触发以下错误:
Error in callback(...) : code: -32602 message: Target position can only be set for new windows
首次调用read_html_live()可正常执行,但后续相关操作全部失败,两台设备测试均复现该问题。
环境配置
- R:4.4.3
- chromote:0.4.0
- rvest:1.0.4
- Chrome:134.0.6998.36
最小可复现代码
rm(list = ls()) library(rvest) shell("taskkill /im chrome.exe /f") cat("\f") # 此段正常运行 x <- read_html_live("https://opencritic.com/") x$view() # 此处执行失败 y <- read_html_live("https://www.metacritic.com/") # 调用initialize方法同样失败 x$initialize("https://www.metacritic.com/")
可行临时解决办法
- 降级Chrome版本:回退到Chrome 133或更早版本,暂时避开兼容性问题。
- 修改chromote启动参数:创建会话时禁用窗口位置设置,绕过API报错:
library(chromote) # 创建不指定窗口位置的会话 custom_session <- Chromote$new(options = list(launch.args = list("--window-position=0,0" = NULL))) # 使用该会话创建LiveHTML对象 x <- read_html_live("https://opencritic.com/", session = custom_session) - 等待官方修复:chromote大概率会针对Chrome 134的API更新发布适配版本,可关注项目更新动态。
内容的提问来源于stack exchange,提问作者Brett
相关产品推荐
相关产品推荐

