I want to extract links of hits from google search with Rselenium. I cannot get past this error, can somebody point out what I am doing wrong, how to solve this? Example:
library("RSelenium")
google <- "https://www.google.com"
driver <- rsDriver(browser = c("chrome"),chromever = "78.0.3904.105")
remote <- driver$client
remote$navigate(google)
google_query <- remote$findElement("name","q")
google_query$sendKeysToElement(sendKeys = list('error stackoverflow'))
google_query$submitElement()
results <- google_query$findElements(using = "class",value = "iUh30")
link <- results[[1]]
link <- link$getElementText()
## here i was expecting url
Error:
Selenium message:stale element reference: element is not attached to the page document
(Session info: chrome=78.0.3904.108)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/stale_element_reference.html
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
Driver info: driver.version: unknown
Error: Summary: StaleElementReference
Detail: An element command failed because the referenced element is no longer attached to the DOM.
class: org.openqa.selenium.StaleElementReferenceException
Further Details: run errorDetails method
Thanks.