I am making a Twitter bot that can automatically login when I run the script. But whenever I run the script, I get this an error that I cannot find any solutions for. Does anyone have an idea of how to fix it?
I tried to change element to elements and send_keys to send_Keys but it won't work
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_elements_by_class_name('email-input')
password = bot.find_elements_by_class_name('session[password]')
email.clear()
password.clear()
email.send_keys(self.username)
password.send_keys(self.password)
password.send_keys(Keys.RETURN)
ed = TwitterBot('EMAIL HERE', 'PASSWORD HERE')
ed.login()
I hope to get it logging in so I can work further on my project.
findmethod returns? You probably need to get the first element of the list.email.send_keys(self.username)make sense?Traceback (most recent call last): File "TwitterBot.py", line 24, in <module> ed.login() File "TwitterBot.py", line 19, in login email.send_keys(self.username) AttributeError: 'list' object has no attribute 'send_keys'