Skip to content

Instantly share code, notes, and snippets.

Last active March 1, 2016 10:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kurozumi/63843b740599704f2fde to your computer and use it in GitHub Desktop.
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from import By
from import WebDriverWait
from import expected_conditions as EC
# Firefox起動
driver = webdriver.Firefox()
# googleへ
while True:
# 標準入力の値を取得
keyword = raw_input()
# 入力フォームの値をクリアにする
# 入力フォームの要素を探す
element = driver.find_element_by_name("q")
# 入力フォームにキーワードを入力する
# フォームを送信する
# titleタグに標準入力したキーワードが含まれるまで10秒待つ
WebDriverWait(driver, 10).until(
# タイトル表示
print driver.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment