Skip to content

Instantly share code, notes, and snippets.

@momota10s
Created July 2, 2017 08:34
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save momota10s/969d904b4cad239da2a5c00df1ad87e7 to your computer and use it in GitHub Desktop.
Save momota10s/969d904b4cad239da2a5c00df1ad87e7 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from getpass import getpass
def login_twitter(username, password):
driver = webdriver.Firefox()
driver.get("https://twitter.com/login")
username_field = driver.find_element_by_class_name("js-username-field")
password_field = driver.find_element_by_class_name("js-password-field")
username_field.send_keys(username)
driver.implicitly_wait(1)
password_field.send_keys(password)
driver.implicitly_wait(1)
driver.find_element_by_class_name("EdgeButtom--medium").click()
if __name__ == "__main__":
username = input("user name : ")
password = getpass("password : ")
login_twitter(username, password)
@EnhboldH
Copy link

EnhboldH commented Apr 7, 2021

how to find login button?

Actually you can send newline character "\n" after your password.
for example:
username: "username"
password: "password\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment