一、像这种需要点击输入,拖动模拟人工操作,且不好抓包处理的,我们可以用模拟浏览器解决掉他。
如selenium +chrome/phantomJs等。
首先我们要找到两张图片:没有缺口和有缺口的图片(用于对比找到缺口位置)
获取图片流的方法可以用如下方法;
/**
* @param file 图像地址,可以是网址或者本地路径
* @return 返回图像流
*/
public BufferedImage getImage(String file) {
URL url;
BufferedImage bi = null;
String http = "http";
String https = "https";
String get = "GET";
try {
//https
if (file.trim().startsWith(https)) {
url = new URL(file);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod(get);
//http
} else if (file.trim().startsWith(http)) {
url = new URL(file);