Last active
March 17, 2016 11:57
-
-
Save kurozumi/844d1e3832b62fa51a23 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_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