Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
【Python】Seleniumを使ってツイッター検索する方法
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
You can’t perform that action at this time.