【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