执行appcrawler命令报错

想问下,在使用appcrawler过程中有人遇到过这个问题吗?没有找元素,百度无果,麻烦大佬们指点一下,谢谢,具体信息如下:

问题描述:通过appcrawler命令启动App 后,控制台报错,App 启动后没响应

appium版本信息:1.21.0

命令:java -jar appcrawler-2.1.3.jar -a 2.8.1_UnKnownVersion_debug_dev.apk

日志信息:

Last login: Wed Sep 29 16:53:21 on ttys005
kongdexi@kongdexideMac-mini ~ % cd                                             
kongdexi@kongdexideMac-mini ~ % cd AndroidStudioProjects/自动化测试/AppCrawler 
kongdexi@kongdexideMac-mini AppCrawler % java -jar appcrawler-2.1.3.jar -a 2.8.1_UnKnownVersion_debug_dev.apk 
2021-09-29 17:02:26 INFO [DataRecord.append.13] append 1
2021-09-29 17:02:26 INFO [AppCrawler$.main.87] 
----------------
AppCrawler 2.1.3 [霍格沃兹测试学院特别纪念版]
Appium 1.7.1 Java8 support
app爬虫, 用于自动遍历测试. 支持Android和iOS, 支持真机和模拟器
帮助文档: https://github.com/seveniruby/AppCrawler
移动测试技术交流: https://testerhome.com
联络作者: seveniruby@testerhome.com (思寒)
致谢: 晓光 泉龙 杨榕 恒温 mikezhou yaming116 沐木
感谢如下公司提供商业支持: Keep
--------------------------------

    
2021-09-29 17:02:26 INFO [AppCrawler$.parseParams.219] Set Platform=Android
2021-09-29 17:02:26 INFO [AppCrawler$.parseParams.234] app path = /Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk
2021-09-29 17:02:26 INFO [AppCrawler$.parseParams.245] use default appium address 4723
2021-09-29 17:02:26 INFO [AppCrawler$.parseParams.252] appium address = Some(http://127.0.0.1:4723/wd/hub)
2021-09-29 17:02:26 INFO [AppCrawler$.parseParams.264] result directory = Android_20210929170226
2021-09-29 17:02:26 INFO [DataRecord.initLog.30] alread exist
2021-09-29 17:02:26 INFO [DataRecord.append.13] append 1
2021-09-29 17:02:26 INFO [Crawler.start.126] set xpath attribute with List(name, label, value, resource-id, content-desc, index, text)
2021-09-29 17:02:26 INFO [Crawler.start.129] set xpath
2021-09-29 17:02:26 INFO [Crawler.loadPlugins.82] dynamic load plugin in /Users/kongdexi/AndroidStudioProjects/%e8%87%aa%e5%8a%a8%e5%8c%96%e6%b5%8b%e8%af%95/AppCrawler/plugins/
2021-09-29 17:02:27 WARN [Runtimes$.loadPlugins.83] no /Users/kongdexi/AndroidStudioProjects/%e8%87%aa%e5%8a%a8%e5%8c%96%e6%b5%8b%e8%af%95/AppCrawler/plugins/ directory, skip
2021-09-29 17:02:27 INFO [Crawler.loadPlugins.84] found dynamic plugins size 0
2021-09-29 17:02:27 INFO [Crawler.$anonfun$loadPlugins$5.86] com.testerhome.appcrawler.plugin.TagLimitPlugin@ae2db25
2021-09-29 17:02:27 INFO [Crawler.$anonfun$loadPlugins$5.86] com.testerhome.appcrawler.plugin.ReportPlugin@2a4f5433
2021-09-29 17:02:27 INFO [Crawler.$anonfun$loadPlugins$5.86] com.testerhome.appcrawler.plugin.FreeMind@29149030
2021-09-29 17:02:27 INFO [TagLimitPlugin.init.17] com.testerhome.appcrawler.plugin.TagLimitPlugin init
2021-09-29 17:02:27 INFO [ReportPlugin.init.17] com.testerhome.appcrawler.plugin.ReportPlugin init
2021-09-29 17:02:27 INFO [FreeMind.init.17] com.testerhome.appcrawler.plugin.FreeMind init
2021-09-29 17:02:27 INFO [ReportPlugin.start.21] reportPath=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/Android_20210929170226
2021-09-29 17:02:27 INFO [ReportPlugin.start.24] create /Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/Android_20210929170226/tmp/ directory
2021-09-29 17:02:27 INFO [Crawler.start.132] prepare setup Appium
2021-09-29 17:02:27 INFO [Crawler.setupAppium.262] use AppiumClient
九月 29, 2021 5:02:36 下午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Detected dialect: W3C
2021-09-29 17:02:36 INFO [AppiumClient.setPlatformName.43] set platform android
2021-09-29 17:02:36 INFO [AppiumClient.getDeviceInfo.217] screenWidth=1080 screenHeight=2288
2021-09-29 17:02:36 INFO [AppiumClient.appium.171] capture dir = /Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/.
2021-09-29 17:02:36 INFO [Crawler.start.139] platformName=Android driver=com.testerhome.appcrawler.driver.AppiumClient@3e1fd62b
2021-09-29 17:02:36 INFO [Crawler.start.140] 
----------------
AppCrawler 2.1.3 [霍格沃兹测试学院特别纪念版]
Appium 1.7.1 Java8 support
app爬虫, 用于自动遍历测试. 支持Android和iOS, 支持真机和模拟器
帮助文档: https://github.com/seveniruby/AppCrawler
移动测试技术交流: https://testerhome.com
联络作者: seveniruby@testerhome.com (思寒)
致谢: 晓光 泉龙 杨榕 恒温 mikezhou yaming116 沐木
感谢如下公司提供商业支持: Keep
--------------------------------

    
2021-09-29 17:02:36 INFO [Crawler.start.141] waiting for app load
2021-09-29 17:02:44 INFO [Crawler.start.143] driver=null
2021-09-29 17:02:44 INFO [Crawler.start.144] get screen info
2021-09-29 17:02:44 INFO [AppiumClient.getDeviceInfo.217] screenWidth=1080 screenHeight=2288
2021-09-29 17:02:44 INFO [Crawler.refreshPage.554] refresh page
2021-09-29 17:02:44 INFO [AppiumClient.getPageSource.308] start to get page source from appium
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.153] exception
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.154] org.openqa.selenium.UnsupportedCommandException: Method is not implemented
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'kongdexideMac-mini.local', ip: 'fe80:0:0:0:85b:665:b687:730c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_131'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.jlpay.merch, statBarHeight=112, noReset=true, viewportRect={top=112, left=0, width=1080, height=2176}, fullReset=false, deviceName=NZKRMFZ9RSLRAQGY, platform=LINUX, deviceUDID=NZKRMFZ9RSLRAQGY, desired={appActivity=, app=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk, appPackage=, appium=http://127.0.0.1:4723/wd/hub, noReset=true, autoLaunch=true, platformName=Android, fullReset=false, deviceName=demo}, platformVersion=11, webStorageEnabled=false, takesScreenshot=true, javascriptEnabled=true, deviceApiLevel=30, deviceManufacturer=OPPO, platformName=LINUX, app=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk, deviceScreenSize=1080x2400, networkConnectionEnabled=true, appium=http://127.0.0.1:4723/wd/hub, warnings={}, databaseEnabled=false, appActivity=, autoLaunch=true, pixelRatio=3, locationContextEnabled=false, deviceScreenDensity=480, deviceModel=PDKM00}]
Session ID: cb4653bf-6c68-4578-a55b-b84850bac749
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.155] java.util.concurrent.FutureTask.report(FutureTask.java:122)
java.util.concurrent.FutureTask.get(FutureTask.java:206)
com.testerhome.appcrawler.driver.WebDriver.$anonfun$asyncTask$1(WebDriver.scala:138)
scala.util.Try$.apply(Try.scala:209)
com.testerhome.appcrawler.driver.WebDriver.asyncTask(WebDriver.scala:129)
com.testerhome.appcrawler.driver.WebDriver.asyncTask$(WebDriver.scala:128)
com.testerhome.appcrawler.driver.AppiumClient.asyncTask(AppiumClient.scala:25)
com.testerhome.appcrawler.driver.AppiumClient.$anonfun$getPageSource$1(AppiumClient.scala:311)
scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:156)
com.testerhome.appcrawler.driver.AppiumClient.getPageSource(AppiumClient.scala:310)
com.testerhome.appcrawler.Crawler.refreshPage(Crawler.scala:555)
com.testerhome.appcrawler.Crawler.start(Crawler.scala:146)
com.testerhome.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:344)
com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:312)
com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:92)
com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)
2021-09-29 17:02:44 WARN [AppiumClient.$anonfun$getPageSource$1.340] get page source error
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.153] exception
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.154] org.openqa.selenium.UnsupportedCommandException: Method is not implemented
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'kongdexideMac-mini.local', ip: 'fe80:0:0:0:85b:665:b687:730c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_131'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.jlpay.merch, statBarHeight=112, noReset=true, viewportRect={top=112, left=0, width=1080, height=2176}, fullReset=false, deviceName=NZKRMFZ9RSLRAQGY, platform=LINUX, deviceUDID=NZKRMFZ9RSLRAQGY, desired={appActivity=, app=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk, appPackage=, appium=http://127.0.0.1:4723/wd/hub, noReset=true, autoLaunch=true, platformName=Android, fullReset=false, deviceName=demo}, platformVersion=11, webStorageEnabled=false, takesScreenshot=true, javascriptEnabled=true, deviceApiLevel=30, deviceManufacturer=OPPO, platformName=LINUX, app=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk, deviceScreenSize=1080x2400, networkConnectionEnabled=true, appium=http://127.0.0.1:4723/wd/hub, warnings={}, databaseEnabled=false, appActivity=, autoLaunch=true, pixelRatio=3, locationContextEnabled=false, deviceScreenDensity=480, deviceModel=PDKM00}]
Session ID: cb4653bf-6c68-4578-a55b-b84850bac749
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.155] java.util.concurrent.FutureTask.report(FutureTask.java:122)
java.util.concurrent.FutureTask.get(FutureTask.java:206)
com.testerhome.appcrawler.driver.WebDriver.$anonfun$asyncTask$1(WebDriver.scala:138)
scala.util.Try$.apply(Try.scala:209)
com.testerhome.appcrawler.driver.WebDriver.asyncTask(WebDriver.scala:129)
com.testerhome.appcrawler.driver.WebDriver.asyncTask$(WebDriver.scala:128)
com.testerhome.appcrawler.driver.AppiumClient.asyncTask(AppiumClient.scala:25)
com.testerhome.appcrawler.driver.AppiumClient.$anonfun$getPageSource$1(AppiumClient.scala:311)
scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:156)
com.testerhome.appcrawler.driver.AppiumClient.getPageSource(AppiumClient.scala:310)
com.testerhome.appcrawler.Crawler.refreshPage(Crawler.scala:555)
com.testerhome.appcrawler.Crawler.start(Crawler.scala:146)
com.testerhome.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:344)
com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:312)
com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:92)
com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)
2021-09-29 17:02:44 WARN [AppiumClient.$anonfun$getPageSource$1.340] get page source error
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.153] exception
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.154] org.openqa.selenium.UnsupportedCommandException: Method is not implemented
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'kongdexideMac-mini.local', ip: 'fe80:0:0:0:85b:665:b687:730c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_131'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.jlpay.merch, statBarHeight=112, noReset=true, viewportRect={top=112, left=0, width=1080, height=2176}, fullReset=false, deviceName=NZKRMFZ9RSLRAQGY, platform=LINUX, deviceUDID=NZKRMFZ9RSLRAQGY, desired={appActivity=, app=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk, appPackage=, appium=http://127.0.0.1:4723/wd/hub, noReset=true, autoLaunch=true, platformName=Android, fullReset=false, deviceName=demo}, platformVersion=11, webStorageEnabled=false, takesScreenshot=true, javascriptEnabled=true, deviceApiLevel=30, deviceManufacturer=OPPO, platformName=LINUX, app=/Users/kongdexi/AndroidStudioProjects/自动化测试/AppCrawler/2.8.1_UnKnownVersion_debug_dev.apk, deviceScreenSize=1080x2400, networkConnectionEnabled=true, appium=http://127.0.0.1:4723/wd/hub, warnings={}, databaseEnabled=false, appActivity=, autoLaunch=true, pixelRatio=3, locationContextEnabled=false, deviceScreenDensity=480, deviceModel=PDKM00}]
Session ID: cb4653bf-6c68-4578-a55b-b84850bac749
2021-09-29 17:02:44 ERROR [AppiumClient.asyncTask.155] java.util.concurrent.FutureTask.report(FutureTask.java:122)
java.util.concurrent.FutureTask.get(FutureTask.java:206)
com.testerhome.appcrawler.driver.WebDriver.$anonfun$asyncTask$1(WebDriver.scala:138)
scala.util.Try$.apply(Try.scala:209)
com.testerhome.appcrawler.driver.WebDriver.asyncTask(WebDriver.scala:129)
com.testerhome.appcrawler.driver.WebDriver.asyncTask$(WebDriver.scala:128)
com.testerhome.appcrawler.driver.AppiumClient.asyncTask(AppiumClient.scala:25)
com.testerhome.appcrawler.driver.AppiumClient.$anonfun$getPageSource$1(AppiumClient.scala:311)
scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:156)
com.testerhome.appcrawler.driver.AppiumClient.getPageSource(AppiumClient.scala:310)
com.testerhome.appcrawler.Crawler.refreshPage(Crawler.scala:555)
com.testerhome.appcrawler.Crawler.start(Crawler.scala:146)
com.testerhome.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:344)
com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:312)
com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:92)
com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)
2021-09-29 17:02:44 WARN [AppiumClient.$anonfun$getPageSource$1.340] get page source error
2021-09-29 17:02:44 WARN [Crawler.refreshPage.562] page source get fail, go back
2021-09-29 17:02:44 INFO [Crawler.setElementAction.660] set action to back
2021-09-29 17:02:44 INFO [Crawler.runStartupScript.236] first refresh
2021-09-29 17:02:44 INFO [Crawler.doElementAction.976] current element = _startupActions-Start-0
2021-09-29 17:02:44 INFO [Crawler.doElementAction.977] current index = 0
2021-09-29 17:02:44 INFO [Crawler.doElementAction.978] current action = 
2021-09-29 17:02:44 INFO [Crawler.doElementAction.979] current url = 
2021-09-29 17:02:44 INFO [Crawler.doElementAction.980] current xpath = startupActions-Start-0
2021-09-29 17:02:44 INFO [Crawler.doElementAction.981] current tag path = _startupActions-Start-0
2021-09-29 17:02:44 INFO [Crawler.doElementAction.982] current file name = _
2021-09-29 17:02:44 INFO [Crawler.doElementAction.983] current uri = 	startupActions-Start-0			startupActions
Exception in thread "main" java.util.NoSuchElementException: last of empty ListBuffer
	at scala.collection.mutable.ListBuffer.last(ListBuffer.scala:401)
	at com.testerhome.appcrawler.DataRecord.last(DataRecord.scala:40)
	at com.testerhome.appcrawler.Crawler.doElementAction(Crawler.scala:985)
	at com.testerhome.appcrawler.Crawler.runStartupScript(Crawler.scala:238)
	at com.testerhome.appcrawler.Crawler.start(Crawler.scala:152)
	at com.testerhome.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:344)
	at com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:312)
	at com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:92)
	at com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)
^C%                                                                                                                         kongdexi@kongdexideMac-mini AppCrawler % 

问题已解决,修改appcrawler 版本为2.4.0即可,完整命令如下:

 java -jar appcrawler-2.4.0-jar-with-dependencies.jar -a  2.8.1_UnKnownVersion_debug_dev.apk
关闭