Seleniumの明示的待機について 以下のようなエラーが要素取得時に発生する。 selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document 要素がページ中にアタッチされてないそうだ。 5. Waits — Selenium Python Bindings 2 documentation が参考になる。2種類の待機がある。 明示的な待機 特定要素が特定の状態になるまで、要素の取得を待つというもの。 今までの要素の取得は、 # 待機しない例 element = driver.find_element_by_css_selector('CSS_SELECTOR') だった。ここで要
![Python3 Seleniumの要素取得時の待機](https://cdn-ak-scissors.b.st-hatena.com/image/square/76dcbb787758e4b7ecbdae3cc0668bd02279fcc7/height=288;version=1;width=512/https%3A%2F%2Fblog.ikappio.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fikapblg_black-cat-3739702_1920.jpg)