大家好,又见面了,我是你们的朋友全栈
[Python] 纯文本查看 复制代码#coding:utf8
from selenium import webdriver
import time
def sign_up():
url = r’https://passport.jd.com/new/login.aspx?ReturnUrl=http://vip.jd.com/’
dr = webdriver.Firefox()
#dr = webdriver.PhantomJS()
dr.get(url)
try:
try:
login = dr.find_element_by_class_name(‘login-tab-r’)
login.click()
loginname = dr.find_element_by_id(‘loginname’)
loginname.send_keys(‘xxxxxxxx’)#用户名
password = dr.find_element_by_id(‘nloginpwd’)
password.send_keys(‘xxxxxxxxx’)#密码
loginsubmit = dr.find_element_by_id(‘loginsubmit’)
loginsubmit.click()
dou = dr.find_element_by_id(‘checkinBtn’)
dou.click()
except:
print “first error”
try:
time.sleep(3)
url_jr = r’https://vip.jr.jd.com’
dr.get(url_jr)
jr_dou = dr.find_element_by_id(‘index-qian-btn’)
jr_dou.click()
except:
print “second error”
except:
print “error”
finally:
dr.close()
sign_up()
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/193654.html原文链接:https://javaforall.cn