I am using Selenium on Stockpair Website
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()
I get the error
Error: Summary: StaleElementReference
Detail: An element command failed because the referenced element is no longer attached to the DOM.
class: org.openqa.selenium.StaleElementReferenceException
I researched that it happens if the DOM changes by an asynchronous process. However, I tested with Selenium running chrome.exe visible and the DOM doesnt change and th element is still there after loading the page.
Can there be other causes?
This is quite a dynamic site with periodical updates which change the DOM.
Click the element via JavaScript:
Also see: