Please give us some advice. The submit information of Douban is shown in the figure
code is as follows:
click, ENTER, RETURN, SPACE are all useless
from selenium import webdriver -sharp selenium
from selenium.webdriver.common.keys import Keys
def loginZhihu():
loginurl = "https://accounts.douban.com/login" -sharp
-sharp webdriver
driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
driver.get(loginurl) -sharp
driver.find_element_by_name("form_email").clear() -sharp
driver.find_element_by_name("form_email").send_keys(u"5467878878") -sharp
driver.find_element_by_name("form_password").clear() -sharp
driver.find_element_by_name("form_password").send_keys(u"454354543543") -sharp
captcha = driver.find_element_by_id("captcha_image") -sharp
submit = driver.find_element_by_css_selector("input[class="bn-submit"]") -sharp
-sharp
if captcha:
captcha_field = driver.find_element_by_id("captcha_field") -sharp
text = input(":") -sharp
captcha_field.send_keys(text) -sharp selenium
submit.send_keys(Keys.RETURN) -sharp
else:
submit.send_keys(Keys.RETURN) -sharp
cookies = driver.get_cookies() -sharp
driver.get("https://movie.douban.com/") -sharp
return cookies -sharp cookies
loginZhihu()