最近大手サイトはjQueryを使わないようなのでアレですが、PythonのSeleniumを使ってjQueryが読み込まれるまで待つ方法を紹介します。
サンプルコードは以下のとおりです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
driver = webdriver.Firefox() | |
driver.get("https://mixi.jp") | |
WebDriverWait(driver, 30).until( | |
lambda driver: driver.execute_script('return !!window.jQuery && window.jQuery.active == 0') | |
) | |
driver.quit() |