Created
March 17, 2016 12:12
-
-
Save kurozumi/51bf86c9b636203f64e5 to your computer and use it in GitHub Desktop.
【Python】Seleniumを使って部分一致で指定したアンカーテキストを探してクリックする方法
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
# coding: utf-8 | |
from selenium import webdriver | |
import time | |
# FireFoxを起動 | |
driver = webdriver.Firefox() | |
# ヤフーへアクセス | |
driver.get("http://www.yahoo.co.jp") | |
# ニューに部分一致するアンカーテキストを探してクリック | |
driver.find_element_by_partial_link_text(u"ニュー").click() | |
# 5秒待つ | |
time.sleep(5) | |
# 終了 | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment