|
@@ -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();
|