你没有看错,全自动验证~~~
黑科技?还是黑代码?
我感觉这个看在你用啥,对不对?反正我用来(* * * * ) 你懂得
好了,先说一下用到的东西
- selenium (本意是用来全自动测试)
- Phantomjs (一种没有界面的浏览器)
- ** 验证码识别器(一块钱可用100次的这种)
关门放代码
from selenium import webdriver
from PIL import Image
if __name__ == '__main__':
wbe = webdriver.PhantomJS()
wbe.get("https://www.某个网站的登录页面.com/login/index.html")//你可以拿知乎,百度,等等测试
element = wbe.find_element_by_xpath('//*[@id="entry_name"]/p[3]/img')//验证码所在的xpath路径
left = element.location['x']
top = element.location['y']
right = element.location['x'] + element.size['width']
bottom = element.location['y'] + element.size['height']
im = Image.open(r'登录页.png')//全页面截屏
im = im.crop((left, top, right, bottom))
im.save('验证码.png')
#!/usr/bin/env python
# coding:utf-8
import requests
from hashlib import md5
class RClient(object):
def