Skip to main content
1 de 2
Alex
  • 126
  • 2

Siempre deberias de usar 4 espacios. https://www.python.org/dev/peps/pep-0008/#indentation

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

class TwitterBot:
    def __init__(self,username, password):
        self.username=username
        self.password = password
        self.bot=webdriver.Firefox()

    def login(self):
        bot=self.bot  
        bot.get("https://twitter.com")
        time.sleep(3)
        email=bot.find_element_by_class_name("email-input")
        password=bot.find_element_by_name("session[password]")
        email.clear()
        password.clear()
        email.send_keys(self.username)
        password.send_keys(self.password)

Alex = TwitterBot("[email protected]", "xxxxxx")
Alex.login()
Alex
  • 126
  • 2