使用Docker+RSelenium调用getElementText()时遭遇'subscript out of bounds'错误的求助
使用Docker+RSelenium调用getElementText()时遭遇'subscript out of bounds'错误的求助
各位好,我去年用Docker搭配RSelenium从网站下拉菜单提取文本的代码今年突然失效了,调用getElementText()的时候一直弹出这个错误:
"Error in resContent[["status"]] : subscript out of bounds"
我在网上搜了一圈,没找到遇到同样问题的案例,下面是可复现的示例代码:
# Load libraries library(tidyverse) library(RSelenium) library(rvest) eCaps <- list(chromeOptions = list( args = c("--window-size=1920,1080", "--disable-extensions", "--proxy-server='direct://'", "--proxy-bypass-list=*", "--start-maximized", "--headless", "--desable-gpu", "--disable-dev-shm-usage", "--no-sandbox", "--ignore-certificate-errors" ), prefs = list("profile.default_content_settings.popups" = 0L, "download.prompt_for_download" = FALSE) )) shell('docker run -d -p 4445:4444 selenium/standalone-chrome') remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome", extraCapabilities = eCaps) remDr$open() remDr$navigate("https://demoqa.com/select-menu") remDr$screenshot(display = TRUE) WebElem <- remDr$findElement("id", "oldSelectMenu") WebElemText <- WebElem$getElementText()
备注:内容来源于stack exchange,提问作者K S
相关产品推荐
相关产品推荐

