Last active
March 16, 2016 12:19
-
-
Save kurozumi/a7222cff4f9e541add13 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 | |
from selenium.webdriver.common.keys import Keys | |
import time | |
# FireFoxを起動 | |
driver = webdriver.Firefox() | |
# Googleにアクセス | |
driver.get("https://www.google.co.jp") | |
# 検索ボックスの要素を取得 | |
element = driver.find_element_by_name("q"); | |
# キーワード入力 | |
element.send_keys("sss") | |
# 10秒待つ | |
time.sleep(10) | |
# キーワードを消す | |
element.clear() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment