From 1743b1262dfe87d2e7b3d65a343a11a87fd62006 Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Sat, 2 Jul 2022 00:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=BF=AB=E7=85=A7=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/cloud/sonic/agent/tools/file/UploadTools.java | 2 +- .../java/org/cloud/sonic/agent/websockets/AndroidWSServer.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cloud/sonic/agent/tools/file/UploadTools.java b/src/main/java/org/cloud/sonic/agent/tools/file/UploadTools.java index 0cbba309..857e598c 100644 --- a/src/main/java/org/cloud/sonic/agent/tools/file/UploadTools.java +++ b/src/main/java/org/cloud/sonic/agent/tools/file/UploadTools.java @@ -39,7 +39,7 @@ public class UploadTools { @Autowired public void setRestTemplate(RestTemplate restTemplate) { UploadTools.restTemplate = restTemplate; - baseUrl = "http://" + host + ":" + port + "/api/folder"; + baseUrl = "http://" + host + ":" + port + "/server/api/folder".replace(":80/", "/");; } public static String upload(File uploadFile, String type) { diff --git a/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java b/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java index a9216ebe..a73b4eb7 100644 --- a/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java +++ b/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java @@ -598,6 +598,7 @@ public void onMessage(String message, Session session) { result.put("img", UploadTools.upload(finalAndroidStepHandler.findEle("xpath", msg.getString("xpath")).getScreenshotAs(OutputType.FILE), "keepFiles")); } catch (Exception e) { result.put("errMsg", "获取元素截图失败!"); + e.printStackTrace(); } BytesTool.sendText(session, result.toJSONString()); });