python27+selenium+Phantomjs登录京东
来源:互联网 发布:考勤系统数据库设计 编辑:程序博客网 时间:2024/06/06 01:08
selenium处理验证码还不会搞,之后再更新有验证码的登录
# _*_coding:utf-8_*_from selenium import webdriverimport timeimport requestss = requests.session()from lxml import etreestart_url = "https://passport.jd.com/uc/login?ltype=logout"#driver = webdriver.Firefox()driver = webdriver.PhantomJS()def get_Login_Cookie(): driver.get(start_url) time.sleep(1) elem_name = driver.find_element_by_name("loginname") elem_password = driver.find_element_by_name("nloginpwd") elem_name.clear() elem_password.clear() elem_name.send_keys("账号") elem_password.send_keys("密码") elem_login = driver.find_element_by_id("loginsubmit") elem_login.click() time.sleep(1) print driver.current_url cookies = driver.get_cookies() #print cookies cookie = [] for item in cookies: cookie.append(item['name'] + '=' + item['value']) c = ';'.join(cookie) return cdef islogin(): home_url = "https://home.jd.com/" page = s.get(home_url).text #print page dom = etree.HTML(page) Me = dom.xpath('/html/body/div[4]/div/div/div[2]/div[1]/div[2]/div[1]/div[2]/div[1]/a/text()') if Me: print "Cookie登录成功!" #print Meif __name__ == "__main__": c = get_Login_Cookie() s.headers.update({"cookie":c}) islogin()
0 0
- python27+selenium+Phantomjs登录京东
- 使用selenium+phantomjs模拟登录淘宝
- selenium phantomjs
- selenium+phantomjs
- Selenium+phantomJS
- selenium +phantomjs 登录126邮箱 iframe定位问题
- 使用selenium+PhantomJS 解决Ajax登录页面重定向问题
- phantomjs + selenium headless test
- selenium + PhantomJS 操作
- 爬虫利器:Selenium+PhantomJS
- 使用selenium+phantomjs
- phantomjs+selenium+python爬虫
- Scrapy+Selenium+Phantomjs Demo
- python+selenium+phantomjs 踩坑
- Selenium + phantomjs使用总结
- python selenium phantomjs学习
- 安装Selenium&PhantomJS
- 爬虫-08-selenium & phantomjs
- BZOJ 2301: [HAOI2011]Problem b(莫比乌斯反演,分块,容斥)
- JavaScript实现选项卡时的小技巧
- eCryptfs - unlink系统调用
- 【NOIP2013提高组T6】华容道-BFS+SPFA
- “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured
- python27+selenium+Phantomjs登录京东
- 数据结构实验之二叉树一:树的同构
- java工具类mht转html格式文件
- 深入浅出Docker Swarm架构与命令
- C语言程序设计实践-C语言应用实践
- 比较全的as快捷键整理
- 注释有问题的dubbo服务和 本地启动dubbo服务的网络IP问题
- binbinyang---Android实现显示GIF图片
- 异构、同构 &&异步、同步