Created
March 1, 2016 13:57
-
-
Save kurozumi/4f3f1ac181f043cd3da4 to your computer and use it in GitHub Desktop.
【Python・SeleniumのWait機能の使い方】任意のテキストとタイトルタグのテキストが一致するまで待つ
This file contains hidden or 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
# 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