Last active
February 14, 2016 05:44
-
-
Save kurozumi/dfde0127c752b4c6ad35 to your computer and use it in GitHub Desktop.
【Python】SeleniumでTwitterにログインする方法
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) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment