AppCrawler AppCrawler 在运行时报 com.fasterxml.jackson.databind.exc.MismatchedInputException 异常

小不溜 · 2019年12月09日 · 最后由 木若若 回复于 2019年12月21日 · 2734 次阅读

异常情况
$ java -jar appcrawler-2.4.0.jar -c xueqiu.yml

2019-12-09 19:42:29 INFO [AppCrawler$.86.main]

AppCrawler 2.4.0 [霍格沃兹测试学院特别纪念版]
Appium 1.8.1 Java8 tested
app 爬虫, 用于自动遍历测试. 支持 Android 和 iOS, 支持真机和模拟器
项目地址: https://github.com/seveniruby/AppCrawler
移动测试技术交流: https://testerhome.com
联络作者: seveniruby@testerhome.com (思寒)
致谢: 晓光 泉龙 杨榕 恒温 mikezhou yaming116 沐木


2019-12-09 19:57:19 INFO [AppCrawler$.203.parseParams] Find Conf /Users/xuchan/Appium/AppCrawler/xueqiu.yml
Exception in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of com.testerhome.appcrawler.Step (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('//*[@resource-id='action_back']')
at com.fasterxml.jackson.module.scala.deser.BuilderWrapper[0]" title="">Source: (StringReader); line: 70, column: 3
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1031)
at com.fasterxml.jackson.databind.deser.ValueInstantiator._createFromStringFallbacks(ValueInstantiator.java:371)
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:323)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1366)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:171)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.fasterxml.jackson.module.scala.deser.SeqDeserializer.deserialize(SeqDeserializerModule.scala:78)
at com.fasterxml.jackson.module.scala.deser.SeqDeserializer.deserialize(SeqDeserializerModule.scala:61)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992)
at com.testerhome.appcrawler.TData$.fromYaml(TData.scala:63)
at com.testerhome.appcrawler.CrawlerConf.load(CrawlerConf.scala:195)
at com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:204)
at com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:91)
at com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)

共收到 7 条回复 时间 点赞
1楼 已删除

1、已经启动 appium 服务
2、手机正常连接
3、用的思寒当时在 2.1.1 版本帖子下的雪球配置文件模板

3楼 已删除

2019-12-09 19:57:19 INFO [AppCrawler$.203.parseParams] Find Conf /Users/xuchan/Appium/AppCrawler/xueqiu.yml
Exception in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of com.testerhome.appcrawler.Step (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('//*[@resource-id='action_back']')

这不已经告诉你了,xpath 写错了,'//[@resource-id='action_back']' 。yaml 格式里,你如果外层用单引号了,里面就不能再用单引号,应该是双引号。比如 "//[@resource-id='action_back']" 区分开

(o´ω`o) ノ OK 谢谢

刚才试了下,将 yml 之前写的

backButton:
- //*[@resource-id='action_back']

改成

- "//*[@resource-id='action_back']"

后保存运行,
依旧在这行报同样的错为 Exception in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of com.testerhome.appcrawler.Step (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('//*[@resource-id='action_back']')

试试在每个元素前加 xpath:呢
冒号后加空格

小不溜 关闭了讨论 07月21日 17:55
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册