0
0

More than 1 year has passed since last update.

selemiumでiframe内のページにアクセス

Last updated at Posted at 2023-02-18

iframe内のページにアクセスする場合

driver = webdriver.Chrome()

# iframe内のページにスイッチ
driver.switch_to.frame(driver.find_element_by_name(iframe name))

# HTMLを取得
print(driver.page_source)

iframe内のページにフォーカスする場合は

driver.switch_to.default_content()

iframe内のHTMLをパースする例

from bs4 import BeautifulSoup

bs = BeautifulSoup(driver.page_source, features='html.parser')
0
0
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
0
0