擅长:python、mysql、java
<p>我现在知道我搞砸了:</p>
<pre><code>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_name('session[username_or_email]')
password = bot.find_element_by_name('session[password]')
email.clear()
password.clear()
email.send_keys(self.username)
password.send_keys(self.password)
ed = TwitterBot('EMAIL HERE', 'PASSWORD HERE')
ed.login()
</code></pre>
<p>在<code>email = bot.find_element_by_name('session[username_or_email]')</code>线上
它是第一个<code>bot.find_element_by_class_name('session[username_or_email]')</code></p>
<p>感觉很蠢。谢谢你们的帮助!在</p>