python+webdriver想登录淘宝,输入用户名密码点登录后,提示请输入验证码,然后怎么解决?
天蓬老师
天蓬老师 2017-04-17 15:44:30
0
2
777
# -*- 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,要怎么解决?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
大家讲道理

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!