当我运行我写的代码时,它只将browser.get('https://www.instagram.com/accounts/password/reset/')
输入到我在这里指定的web。没有任何变化,
username_input = driver.find_element_by_name('username')
NameError: name 'driver' is not defined. Did you mean: 'webdriver'?
字符串
会是什么原因呢?我写的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
browser = webdriver.Firefox()
browser.get('https://www.instagram.com/accounts/password/reset/')
sleep(2)
username_input = driver.find_element_by_name('username')
username_input.send_keys(username)
username_input.send_keys(Keys.ENTER)
sleep(2)
email_input = driver.find_element_by_name('email')
email_input.send_keys(Keys.ENTER)
sleep(2)
driver.quit()
username = '...'
email = '...'
reset_instagram_password(username, email)
型
1条答案
按热度按时间iyr7buue1#
你在变量
"browser = webdriver.Firefox()"
中获取webdriver,但是在搜索元素时,你使用的是"username_input = driver.find_element_by_name('username')"
改成跟着...
字符串