RSelenium 无法访问 DOM

RSelenium cannot access DOM

我在 Stockpair Website

上使用 Selenium
s = remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "chrome")
s$open()
url <- "https://www.stockpair.com/sp#trading/page"
s$navigate(url)
dir <- s$findElement("css selector", "div.stockSelectionButton.left")
dir$clickElement()

我收到错误

Error:   Summary: StaleElementReference
     Detail: An element command failed because the referenced element is no longer attached to the DOM.
     class: org.openqa.selenium.StaleElementReferenceException

我研究过,如果 DOM 由异步进程更改,就会发生这种情况。但是,我测试了 Selenium 运行 chrome.exe 可见并且 DOM 没有改变并且加载页面后元素仍然存在。

会不会有其他原因?

这是一个非常动态的站点,定期更新会改变 DOM。

单击元素 通过 JavaScript:

s$executeScript("arguments[0].click();", list(dir))

另见: