Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: while scanning a simple key
in 'reader', line 71, column 3:
xpath:"//android.view.View[@text ...
^
could not find expected ':'
in 'reader', line 72, column 3:
action: "click"
^
at [Source: (StringReader); line: 70, column: 10] (through reference chain: com.ceshiren.appcrawler.core.CrawlerConf["selectedList"]->com.fasterxml.jackson.module.scala.deser.GenericFactoryDeserializerResolver$BuilderWrapper[3]->com.ceshiren.appcrawler.model.Step["then"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:392)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:351)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1821)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:565)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:438)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1405)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:351)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:184)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:355)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.module.scala.deser.GenericFactoryDeserializerResolver$Deserializer.deserialize(GenericFactoryDeserializerResolver.scala:125)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4675)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3630)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3598)
at com.ceshiren.appcrawler.utils.TData$.fromYaml(TData.scala:57)
at com.ceshiren.appcrawler.core.CrawlerConf.load(CrawlerConf.scala:253)
at com.ceshiren.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:186)
at com.ceshiren.appcrawler.AppCrawler$.main(AppCrawler.scala:73)
at com.ceshiren.appcrawler.AppCrawler.main(AppCrawler.scala)
Caused by: com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException: while scanning a simple key
in 'reader', line 71, column 3:
xpath:"//android.view.View[@text ...
^
could not find expected ':'
in 'reader', line 72, column 3:
action: "click"
^
at [Source: (StringReader); line: 70, column: 10]
at com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException.from(MarkedYAMLException.java:28)
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:407)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:346)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.module.scala.deser.GenericFactoryDeserializerResolver$Deserializer.deserialize(GenericFactoryDeserializerResolver.scala:125)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:542)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:563)
... 19 more
Caused by: while scanning a simple key
in 'reader', line 71, column 3:
xpath:"//android.view.View[@text ...
^
could not find expected ':'
in 'reader', line 72, column 3:
action: "click"
^
at org.yaml.snakeyaml.scanner.ScannerImpl.stalePossibleSimpleKeys(ScannerImpl.java:484)
at org.yaml.snakeyaml.scanner.ScannerImpl.needMoreTokens(ScannerImpl.java:299)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:247)
at org.yaml.snakeyaml.parser.ParserImpl$ParseFlowSequenceEntry.produce(ParserImpl.java:754)
at org.yaml.snakeyaml.parser.ParserImpl$ParseFlowSequenceFirstEntry.produce(ParserImpl.java:717)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:165)
at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:175)
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:403)
... 24 more
上面是报错记录
这个地方告诉你了, 71行格式有错误, 估计是xpath后面的: 你没加空格
2022-07-25 20:22:17 INFO [AppCrawler$.326.addLogFile]
appcrawler v2.7.4 全平台自动遍历测试工具
Q&A: appcrawler - 测试人社区
author: 思寒_seveniruby 天马 霍格沃兹测试开发学社
2022-07-25 20:22:17 INFO [AppCrawler$.329.addLogFile] result directory = 20220725202216_com.jinbaoxin.jytaobao
2022-07-25 20:22:17 DEBUG [AppCrawler$.44.getGlobalEncoding] default Charset=GBK
2022-07-25 20:22:17 DEBUG [AppCrawler$.45.getGlobalEncoding] default file.encoding=GBK
2022-07-25 20:22:17 DEBUG [AppCrawler$.46.getGlobalEncoding] project directory=D:\Program%20Files%20(x86)\appcrawler
2022-07-25 20:22:17 DEBUG [Crawler.123.start] crawl config
2022-07-25 20:22:17 DEBUG [Crawler.124.start] —
capabilityDescription: “appium的capability通用配置,其中automationName代表自动化的驱动引擎,除了支持appium的
所有引擎外,额外增加了adb和selenium的支持”
capability:
deviceName: “emulator-5554”
platformVersion: “7.1.2”
platformName: “Android”
appium: “http://127.0.0.1:4723/wd/hub”
noReset: “true”
appPackage: “*******”
fullReset: “false”
automationName: “uiautomator2”
appActivity: “.**************”
waitAppLoadedTimeoutDescription: “隐式等待app加载完成的最大时间 ms”
waitAppLoadedTimeout: 10000
waitAppLoadedDescription: “显式等待app加载完成的判断条件”
waitAppLoaded:
- given:
when: null
then:
xpath: “//*[contains(@text, ‘App’)]”
action: “”
actions:
times: -1
implicitlyWaitTestCaseDescription: “在测试用例执行阶段隐式等待一个控件出现的最大时间 ms”
implicitlyWaitTestCase: 3000
implicitlyWaitCrawlDescription: “在遍历阶段隐式等待一个控件出现的最大时间 ms”
implicitlyWaitCrawl: 0
testcaseDescription: “测试用例设置,用于遍历开始之前的一些前置操作,比如自动登录”
testcase:
name: “jiuyezaixiandemo”
steps:
- given:
when: null
then:
xpath: “//”
action: “Thread.sleep(50)”
actions:
times: 1
maxTimeDescription: “最大运行时间”
maxTime: 10800
maxDepthDescription: “默认的最大深度10, 结合baseUrl可很好的控制遍历的范围”
maxDepth: 10
selectedListDescription: “默认遍历列表,只有出现在这个列表里的控件范围才会被遍历”
selectedList:
- given:
when: null
then:
xpath: “//android.widget.TextView[@text=‘政策资讯’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘网投简历:四种方法提效率’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//*[@resource-id= ‘com.jinbaoxin.jytaobao:id/close_img’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘就业政策’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘视频指导’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘求职指南’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.widget.EditText[@text=‘请输入’]”
action: “简历”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘搜索’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text='如何在个人简历中避免不利因素]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//*[@resource-id=‘com.jinbaoxin.jytaobao:id/close_img’]”
action: “click”
actions:
times: 1
triggerActionsDescription: “在遍历过程中需要随时处理的一些操作,比如弹框、登录等”
triggerActions:
- given:
when: null
then:
xpath: “permission_allow_button”
action: “”
actions:
times: 3
- given:
when: null
then:
xpath: “允许”
action: “”
actions:
times: 3
blackListDescription: “黑名单列表 matches风格, 默认排除内容包含2个数字的控件”
blackList:
- given:
when: null
then:
xpath: “.[0-9]{2}.”
action: “”
actions:
times: 0
firstListDescription: “优先遍历列表,同时出现在selectedList与firstList中的控件会被优先遍历”
firstList:
- given:
when: null
then:
xpath: “//android.widget.TextView[@text=‘政策资讯’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘网投简历:四种方法提效率’]”
action: “click”
actions:
times: 1
lastListDescription: “最后遍历列表,同时出现在selectedList与lastList中的控件会被最后遍历”
lastList:
- given:
when: null
then:
xpath: “//android.widget.EditText[@text=‘请输入’]”
action: “简历”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text=‘搜索’]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//android.view.View[@text='如何在个人简历中避免不利因素]”
action: “click”
actions:
times: 1
- given:
when: null
then:
xpath: “//*[@resource-id=‘com.jinbaoxin.jytaobao:id/close_img’]”
action: “click”
actions:
times: 1
backButtonDescription: “后退按钮列表,默认在所有控件遍历完成后,才会最后点击后退按钮。目前具备了自动判断返回按钮的能力,默认不需要配置”
backButton:
- given:
when: null
then:
xpath: “//*[@resource-id=‘com.jinbaoxin.jytaobao:id/close_img’]”
action: “click”
actions:
times: 1
xpathAttributesDescription: “在生成一个控件的唯一定位符中应该包含的关键属性”
xpathAttributes:
- “name()”
- “name”
- “label”
- “value”
- “resource-id”
- “content-desc”
- “text”
- “id”
- “name”
- “innerText”
- “tag”
- “class”
sortByAttributeDescription: “陆续根据属性进行遍历排序微调,depth表示从dom中最深层的控件开始遍历,list表示dom中列表优先,
selected表示菜单最后遍历,这是默认规则,一般不需要改变”
sortByAttribute:
- “depth”
- “list”
- “selected”
findByDescription: “默认生成控件唯一定位符的表达式风格,可选项 default|android|id|xpath,默认会自动判断是否使用android定
位或者ios定位”
findBy: “default”
baseUrlDescription: “设置一个起始点,从这个起始点开始计算深度,比如默认从登录后的界面开始计算”
baseUrl:
appWhiteListDescription: “app白名单,允许在这些app里进行遍历”
appWhiteList:
urlBlackListDescription: “url黑名单,用于排除某些页面的遍历”
urlBlackList:
urlWhiteListDescription: “url白名单,仅在这些界面内遍历”
urlWhiteList:
beforeRestartDescription: “在重启session之前做的事情”
beforeRestart:
beforeElementDescription: “在遍历每个控件之前默认执行的动作”
beforeElement:
afterElementDescription: “在遍历每个控件之后默认执行的动作”
afterElement:
afterElementWaitDescription: “在遍历每个控件之后默认等待的时间,用于等待新页面加载”
afterElementWait: 1000
afterAllDescription: “在遍历完当前页面内的所有控件后,是否需要刷新或者滑动”
afterAll:
afterAllMaxDescription: “afterAll的最大重试次数,比如连续滑动2次都没新元素即取消”
afterAllMax: 2
tagLimitMaxDescription: “相似控件最多点击几次”
tagLimitMax: 2
tagAttributesDescription: “用于判断是否是相似控件的关键属性,祖先节点具备相同的属性认为是相似”
tagAttributes:
- “name()”
- “name”
- “label”
- “resource-id”
- “content-desc”
- “id”
- “name”
- “tag”
- “class”
tagLimitDescription: “设置部分相似控件的最大遍历次数”
tagLimit:
- given:
when: null
then:
xpath: “确定”
action: “”
actions:
times: 1000
- given:
when: null
then:
xpath: “取消”
action: “”
actions:
times: 1000
- given:
when: null
then:
xpath: “share_comment_guide_btn_name”
action: “”
actions:
times: 1000
assertGlobalDescription: “全局断言”
assertGlobal:
suiteNameDescription: “报告中的测试套件名字可以由列表内的控件内容替换,增强报告中关键界面的辨识度”
suiteName:
- “//*[@selected=‘true’]//android.widget.TextView/@text”
screenshotDescription: “是否截图”
screenshot: true
reportTitleDescription: “报告的title”
reportTitle: “”
resultDirDescription: “结果目录,如果为空会自动创建对应时间戳_报名的结果目录”
resultDir: “20220725202216_com.jinbaoxin.jytaobao”
showCancelDescription: “是否展示跳过的控件记录”
showCancel: true
pluginListDescription: “插件列表,暂时禁用,太高级了,很多人不会用”
Description: “。在selectedList firstList lastList等很多配置中,需要填充的是测试步骤Step类型。Step类型由given(
满足条件)when(条件满足的行为)then(断言)三部分组成。Step可以简化为xpath(定位表达式,支持xpath 正则 包含关系)与action(点击
\ 输入等行为)。”
pluginList:
2022-07-25 20:22:17 INFO [Crawler.126.start] set xpath attribute with List(name(), name, label, value, resource-id, content-desc, text, id, name, innerText, tag, class)
2022-07-25 20:22:17 INFO [Crawler.130.start] set tag attribute with List(name(), name, label, resource-id, content-desc, id, name, tag, class)
2022-07-25 20:22:17 INFO [Crawler.100.$anonfun$loadPlugins$3] com.ceshiren.appcrawler.plugin.TagLimitPlugin@f2fed4
2022-07-25 20:22:17 INFO [Crawler.100.$anonfun$loadPlugins$3] com.ceshiren.appcrawler.plugin.ReportPlugin@f4e0bf
2022-07-25 20:22:17 INFO [Crawler.100.$anonfun$loadPlugins$3] com.ceshiren.appcrawler.plugin.FreeMind@5a26e1
2022-07-25 20:22:17 INFO [Plugin.22.init] com.ceshiren.appcrawler.plugin.TagLimitPlugin init
2022-07-25 20:22:17 INFO [Plugin.22.init] com.ceshiren.appcrawler.plugin.ReportPlugin init
2022-07-25 20:22:17 INFO [Plugin.22.init] com.ceshiren.appcrawler.plugin.FreeMind init
2022-07-25 20:22:17 INFO [ReportFactory$.33.initReportPath] reportPath=D:\Program Files (x86)\appcrawler\AppCrawler-master\20220725202216_com.jinbaoxin.jytaobao
2022-07-25 20:22:17 INFO [ReportFactory$.35.initReportPath] testcaseDir=D:\Program Files (x86)\appcrawler\AppCrawler-master\20220725202216_com.jinbaoxin.jytaobao/tmp/
2022-07-25 20:22:17 INFO [ReportFactory$.38.initReportPath] create D:\Program Files (x86)\appcrawler\AppCrawler-master\20220725202216_com.jinbaoxin.jytaobao\tmp directory
2022-07-25 20:22:17 INFO [Crawler.137.start] prepare setup Appium
2022-07-25 20:22:17 INFO [Crawler.299.setupCrawler] afterAllMax=2
2022-07-25 20:22:19 INFO [Crawler.308.setupDriver] uiautomator2
2022-07-25 20:22:19 INFO [Crawler.344.setupDriver] use AppiumClient
2022-07-25 20:22:19 INFO [AppiumClient.45.] Capabilities {app: , appActivity: .mvp.mvp.ui.activity.Welcom…, appPackage: com.jinbaoxin.jytaobao, appium: http://127.0.0.1:4723/wd/hub, automationName: uiautomator2, deviceName: emulator-5554, fullReset: false, newCommandTimeout: 120, noReset: true, platformName: Android, platformVersion: 7.1.2}
现在有一个新问题 我执行这个demo了 appnium直接闪退了自动关闭了
也没有打印图片
是不是你的app太慢了,导致他以为app就一个简单的页面,然后就退出了。