2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

2020年にSelenium (+Python)でスクレイピングしてハマったところ

Posted at

iframe

症状:「実行画面では表示されているボタンなのにElementが見つからないと言われる!」

→原因と解決策:iframeはいちいち切り替えないとelementが見つけられない

driver.switch_to.frame(driver.find_elements_by_tag_name("iframe")[0])
driver.find_element_by_css_selector("#hogefuga").click()
driver.switch_to.default_content()

Popupによる干渉

症状:ボタンのelementを取得できているのに押せない
エラー文面:

Element <a class="hoge" href="/fuga">...</a> is not clickable at point (748, 591). Other element would receive the click: <div class="piyo">...</div>

→原因と解決策:一旦Bodyなどをクリックしておく

driver.find_element_by_tag_name("body").click()
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?