Last active
February 14, 2016 05:43
-
-
Save kurozumi/4ed136f2e4237863e435 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
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
driver = webdriver.Firefox() | |
driver.implicitly_wait(10) | |
driver.get('https://twitter.com') | |
login = driver.find_element_by_css_selector(".StreamsLogin") | |
login.click() | |
username = driver.find_element_by_xpath("//input[contains(@name, 'username_or_email')]") | |
username.send_keys("username") | |
password = driver.find_element_by_xpath("//input[contains(@name, 'password')]") | |
password.send_keys("password") | |
password.send_keys(Keys.RETURN) | |
search = driver.find_element_by_name("q") | |
search.send_keys("twitter") | |
search.send_keys(Keys.RETURN) | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment