# -*- coding: utf-8 -*-
from selenium import webdriver
driver = webdriver.Chrome()
driver.implicitly_wait(30)
driver.get('https://login.taobao.com/member/login.jhtml')
driver.find_element_by_id("TPL_username_1").send_keys("myname")
time.sleep(1)
driver.find_element_by_id("TPL_password_1").send_keys("pwd")
time.sleep(1)
driver.find_element_by_id("J_SubmitStatic").click()
time.sleep(1)
error_text = driver.find_element_by_class_name('error').text
print error_text
我是新手,获取不到error,要怎么解决?
Look at the documentation to find the method. There are two ways:
The first one is to click directly on the picture:
refreshlink = driver.findelementbyid('JStandardCodem')
refresh_link.click()
The second method is to get the image url, and then get
link = refreshlink.getattribute('src')
driver.get(link)
Maybe I didn’t describe it clearly before. In this question, I just want to know how to get the verification code image.
As for the identification problem, I really need it, so I’ll try it again.
Climb down and enter the verification code manually...or use an image processing library to automatically recognize the verification code.