RSelenium throwing StaleElementReference error

前端 未结 1 747
清酒与你
清酒与你 2021-01-16 10:33

I am trying to scrape this website link using RSelenium. I have successfully scraped most of the contents on the page but was trying to get through to the \"facility visits\

相关标签:
1条回答
  • 2021-01-16 10:59

    You are probably getting a StaleElementReference as a result of clicking the webElem.

    The webElem element is likely modified in the DOM after the click, so if you try to "use" webElem again, it is no longer attached to the DOM and is considered "stale".


    An easy fix is to simply re-locate webElem after it is clicked:

    webElem <- rd$findElement(...
    webElem$clickElement()
    webElem <- rd$findElement(... # re-locate webElem
    webElem$findElements('css',"#aspnetForm > div.page > div.main")
    
    0 讨论(0)
提交回复
热议问题