pythonでselenium使用時に以下エラーが出て処理が止まるため回避方法を教えてください。
==========
selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of [object String] "{\"element-6066-11e4-a52e-4f735466cecf\":\"86116ad5-45ff-4293-9037-88dacaf91578\"}" is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
Stacktrace:
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5
StaleElementReferenceError@chrome://remote/content/shared/webdriver/Errors.jsm:464:5
element.resolveElement@chrome://remote/content/marionette/element.js:681:11
evaluate.fromJSON@chrome://remote/content/marionette/evaluate.js:254:26
evaluate.fromJSON@chrome://remote/content/marionette/evaluate.js:262:29
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm:79:29
==========
プログラムの動作は以下になります。
使用driver :Firefox
エラーで止まる箇所:
ページ内のボタンを下記ループですべて押そうとしているときに処理の途中で止まります。
全てのページで止まるわけではなく、たまに止まってしまう状態です。
elemes = driver.find_elements_by_css_selector('span:nth-child(2) > input')
for elem in elemes:
elem.click()
ソース全文が必要な場合は、取引時に公開させていただきます。