xuzuoyun преди 5 години
родител
ревизия
ec706f6b66

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -120,7 +120,7 @@ public class ShiroConfig {
         //文件上传接口
 		filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
-
+		filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
 		//爬虫接口
 		filterChainDefinitionMap.put("/graphql/video", "anon");
 		filterChainDefinitionMap.put("/ks/web/test", "anon");

+ 2 - 1
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -144,6 +144,7 @@ jeecg:
     csv-upload: D://upFiles//csv//
 kuaishou:
   group-control:
-    path: http://127.0.0.1
+    #    path: http://127.0.0.1
+    path: http://39.106.184.70
     port: 4723
 

+ 27 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/AppiumUtil.java

@@ -130,6 +130,7 @@ public class AppiumUtil {
                     break;
                 default:
                     isContinue = false;
+                    androidDriver.quit();
                     System.out.println("当前activity无法处理");
                     break;
             }
@@ -201,6 +202,7 @@ public class AppiumUtil {
                     if (kwaiId != null) {
                         System.out.println(kwaiId.getText());
                         isContinue = false;
+                        androidDriver.quit();
                     }
                     break;
                 case "com.yxcorp.gifshow.activity.BrowseSettingsActivity":
@@ -383,6 +385,7 @@ public class AppiumUtil {
                     break;
                 default:
                     isContinue = false;
+                    androidDriver.quit();
                     System.out.println("当前activity无法处理");
                     break;
             }
@@ -398,13 +401,34 @@ public class AppiumUtil {
     public WebElement getElementByType(AndroidDriver androidDriver, String type, String typeInfo) {
         WebElement element = null;
         if (type.equals(FIND_ELEMENT_TYPE_ID)) {
-            element = androidDriver.findElementById(typeInfo);
+            try {
+                List<WebElement> elements = androidDriver.findElementsById(typeInfo);
+                if (elements != null && elements.size() > 0) {
+                    element = elements.get(0);
+                }
+            } catch (Exception e) {
+                System.out.println("元素ID:" + typeInfo + "不存在");
+            }
         }
         if (type.equals(FIND_ELEMENT_TYPE_CLASS)) {
-            element = androidDriver.findElementByClassName(typeInfo);
+            try {
+                List<WebElement> elements = androidDriver.findElementsByClassName(typeInfo);
+                if (elements != null && elements.size() > 0) {
+                    element = elements.get(0);
+                }
+            } catch (Exception e) {
+                System.out.println("元素class:" + typeInfo + "不存在");
+            }
         }
         if (type.equals(FIND_ELEMENT_TYPE_XPATH)) {
-            element = androidDriver.findElementByXPath(typeInfo);
+            try {
+                List<WebElement> elements = androidDriver.findElementsByXPath(typeInfo);
+                if (elements != null && elements.size() > 0) {
+                    element = elements.get(0);
+                }
+            } catch (Exception e) {
+                System.out.println("元素xpath:" + typeInfo + "不存在");
+            }
         }
         return element;
     }