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 没有改变,加载页面后元素仍然存在。
会不会有其他原因?