소스 검색

增加图形验证码识别

xuzuoyun 5 년 전
부모
커밋
8ce0671771
1개의 변경된 파일11개의 추가작업 그리고 33개의 파일을 삭제
  1. 11 33
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

+ 11 - 33
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -247,40 +247,18 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 
 //            webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
 //            File scrFile = ((TakesScreenshot)webDriver).getScreenshotAs(OutputType.FILE);
-            WebElement iframeElement = webDriver.findElement(By.tagName("iframe"));
-            if (iframeElement != null) {
-                File scrFile = captureElement(webDriver.findElement(By.tagName("iframe")));
-                //clickCharBg
-                String savePath = "D:/capter.png";
-                FileUtils.copyFile(scrFile, new File(savePath));
-                webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
-                String result = ChaojiyingUtils.process(Base64Utils.ImageToBase64(savePath));
-                System.out.println(result);
-                ((JavascriptExecutor) webDriver).executeScript("arguments[0].click();", webDriver.findElement(By.className("aq_icon_refresh")));
-            }
+//            WebElement iframeElement = webDriver.findElement(By.tagName("iframe"));
+//            if (iframeElement != null) {
+//                File scrFile = captureElement(webDriver.findElement(By.tagName("iframe")));
+//                String savePath = "D:/capter.png";
+//                FileUtils.copyFile(scrFile, new File(savePath));
+//                webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
+//                String result = ChaojiyingUtils.process(Base64Utils.ImageToBase64(savePath));
+//                System.out.println(result);
+//                ((JavascriptExecutor) webDriver).executeScript("arguments[0].click();", webDriver.findElement(By.className("aq_icon_refresh")));
+//            }
+
 
-//            Point point = webDriver.findElement(By.className("standard")).getLocation();
-//            BufferedImage img = ImageIO.read(scrFile);
-//
-//            System.out.println(img.getType());
-//// 创建一个矩形使用上面的高度,和宽度
-//            Rectangle rect = new Rectangle(100, 40);
-////        // 得到元素的坐标
-//
-//            BufferedImage dest = ImageUtils.resize(img.getSubimage(point.x, point.y, rect.width, rect.height),280,40);
-//            // 存为png格式
-//            ImageIO.write(dest, "png", scrFile);
-//            String savePath2 = "D:/sm.png";
-//            FileUtils.copyFile(scrFile, new File(savePath2));
-//            String result = ChaojiyingUtils.process(Base64Utils.ImageToBase64(savePath2));
-//            System.out.println(result);
-//            Point point2 = webDriver.findElement(By.className("oripic")).getLocation();
-//            BufferedImage img2 = ImageIO.read(scrFile);
-//            Rectangle rect2 = new Rectangle(280, 160);
-//            BufferedImage dest2 = img.getSubimage(point2.x, point2.y, rect2.width, rect2.height);
-//            ImageIO.write(dest2, "png", scrFile);
-//            String savePath3 = "D:/big.png";
-//            FileUtils.copyFile(scrFile, new File(savePath3));
             webDriver.get("https://b.e.kuaishou.com/#/home/profile");
             //获取Cookie并打印
             Set<Cookie> cookies = webDriver.manage().getCookies();