代码: # -*- coding: utf-8 -*- """ Created on Fri Jul 13 16:13:52 2018 @author: a """ from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC fr…
selenium模拟登录豆瓣和qq空间今天又重新学习了下selenium,模拟登录豆瓣,发现设置等待时间真的是很重要的一步,不然一直报错:selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element另外,豆瓣的主页(https://www.douban.com/)使用了iframe嵌套了登录页面:<iframe style="height: 300p…
研究QQ登录规则的话,得分析大量Javascript的加密解密,比较耗时间.自己也是练习很少,短时间成功不了.所以走了个捷径. Selenium是一个WEB自动化测试工具,它运行时会直接实例化出一个浏览器,完全模拟用户的操作,比如点击链接.输入表单,点击按钮提交等.所以我们使用它可以很方便的来登录. 但是作为新手还是多多分析,尽量少用这个,以便提高自己的技术.在研究几天,在写一个自己满意的. import time # import random from bs4 import Beautifu…
#encoding=utf-8 from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.common.exceptions import UnexpectedAlertPresentException import time,unittest, re #登录页面 driver=webdriver.Firefox() driver.ge…
使用超级鹰打码平台处理登录的文字点击验证码 import time from io import BytesIO from PIL import Image from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverW…
之前为了抓取兴趣部落里的数据,研究了下QQ自动登录. 当时搜索了一番,发现大部分方法都已经失效了,于是准备自己开搞. 第一个想到的就是参考网上已有方案的做法,梳理登陆js的实现,通过其他语言重写.考虑到js可能会更新,放弃了此方案. 第二个想到的是能不能直接调用QQ自己的js方法,模拟进行提交呢.搜索一番后发现神器 ---- "phantomjs". PhantomJS is a headless WebKit scriptable with a JavaScript API. It…