Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created March 1, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/4f3f1ac181f043cd3da4 to your computer and use it in GitHub Desktop.
Save kurozumi/4f3f1ac181f043cd3da4 to your computer and use it in GitHub Desktop.
【Python・SeleniumのWait機能の使い方】任意のテキストとタイトルタグのテキストが一致するまで待つ
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("https://www.google.co.jp")
# タイトルタグに任意のテキストと一致するタイトルが表示されるまで10秒待つ
try:
WebDriverWait(driver, 10).until(
EC.title_is("Google")
)
finally:
driver.close()
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment