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