目前我的方案是将 noReset 设置为 true,然后在执行之前通过 adb install -g 先安装;
这个问题折腾了快一下午了,有点抓狂
看下报错的提示吧,是不是 appium 的 bug?
看 appium 的 log 是没有报错的
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: source
[HTTP] --> GET /wd/hub/session/25dfe5b2-707b-4a1b-a5c8-f1a7f25f3be9/source {}
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["25dfe5b2-707b-4a1b-a5c8-f1a7f25f3be9"]
[HTTP] --> GET /wd/hub/session/25dfe5b2-707b-4a1b-a5c8-f1a7f25f3be9/source {}
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["25dfe5b2-707b-4a1b-a5c8-f1a7f25f3be9"]
[HTTP] --> GET /wd/hub/session/25dfe5b2-707b-4a1b-a5c8-f1a7f25f3be9/screenshot {}
[MJSONWP] Calling AppiumDriver.getScreenshot() with args: ["25dfe5b2-707b-4a1b-a5c8-f1a7f25f3be9"]
同时看到 APPcrawler 的 log,超时了,,然后就陷入了一个死循环
2018-03-01 13:20:50 INFO [Crawler.refreshPage.554] refresh page
2018-03-01 13:20:50 INFO [AppiumClient.getPageSource.308] start to get page source from appium
2018-03-01 13:21:10 ERROR [AppiumClient.asyncTask.149] 20 seconds timeout
2018-03-01 13:21:10 WARN [AppiumClient.$anonfun$getPageSource$1.340] get page source error
2018-03-01 13:21:30 ERROR [AppiumClient.asyncTask.149] 20 seconds timeout
2018-03-01 13:21:30 WARN [AppiumClient.$anonfun$getPageSource$1.340] get page source error
2018-03-01 13:21:50 ERROR [AppiumClient.asyncTask.149] 20 seconds timeout
2018-03-01 13:21:50 WARN [AppiumClient.$anonfun$getPageSource$1.340] get page source error
碰到了同样的问题,请问楼主后来解决了吗?
提问 appcrawler 可以测试原生和 h5 的混合 app 吗?刚开始研究不太懂
遇到了同样的问题
2018-05-15 12:36:24 INFO [Crawler.start.135] waiting for app load
2018-05-15 12:36:32 INFO [Crawler.start.137] driver=null
2018-05-15 12:36:32 INFO [Crawler.start.138] get screen info
2018-05-15 12:36:33 INFO [AppiumClient.getDeviceInfo.214] screenWidth=1024 screenHeight=768
2018-05-15 12:36:33 INFO [Crawler.refreshPage.537] refresh page
2018-05-15 12:36:53 ERROR [AppiumClient.asyncTask.146] 20 seconds timeout
2018-05-15 12:37:13 ERROR [AppiumClient.asyncTask.146] 20 seconds timeout
2018-05-15 12:37:33 ERROR [AppiumClient.asyncTask.146] 20 seconds timeout
Exception in thread "main" java.lang.NullPointerException
at scala.collection.immutable.StringOps$.length$extension(StringOps.scala:48)
at scala.collection.immutable.StringOps.length(StringOps.scala:48)
at scala.collection.IndexedSeqOptimized$class.isEmpty(IndexedSeqOptimized.scala:27)
at scala.collection.immutable.StringOps.isEmpty(StringOps.scala:30)
at scala.collection.TraversableOnce$class.nonEmpty(TraversableOnce.scala:109)
at scala.collection.immutable.StringOps.nonEmpty(StringOps.scala:30)
at com.testerhome.appcrawler.Crawler.refreshPage(Crawler.scala:541)
at com.testerhome.appcrawler.Crawler.start(Crawler.scala:140)
at com.testerhome.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:342)
at com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:310)
at com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:90)
at com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)
Appium 日志:
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["270dfaf3-4a1f-4f94-8528-187851c6e818"]
[XCUITest] Executing command 'getPageSource'
[JSONWP Proxy] Proxying [GET /source] to [GET http://localhost:8100/session/C2D926F9-396F-43E5-9819-AFC5FBAE63DA/source] with no body
[HTTP] --> GET /wd/hub/session/270dfaf3-4a1f-4f94-8528-187851c6e818/source
[HTTP] {}
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["270dfaf3-4a1f-4f94-8528-187851c6e818"]
[XCUITest] Executing command 'getPageSource'
[HTTP] --> GET /wd/hub/session/270dfaf3-4a1f-4f94-8528-187851c6e818/source
[HTTP] {}
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["270dfaf3-4a1f-4f94-8528-187851c6e818"]
[XCUITest] Executing command 'getPageSource'
[JSONWP Proxy] Got response with status 200: "{\n \"value\" : \"\\n\\n \\n \\n \\n \\n
[JSONWP Proxy] Proxying [GET /source] to [GET http://localhost:8100/session/C2D926F9-396F-43E5-9819-AFC5FBAE63DA/source] with no body
[MJSONWP] Responding to client with driver.getPageSource() result: "\n \n \n \n \n \n
发现跟页面元素多少有关,尤其是 iOS 的页面,尤其慢,但是用 appium inspector 时间虽长还是能最终获取页面的,读了下源码,超时日志是在 WebDriver.scala 输出的:
def asyncTask[T](timeout: Int = 30, restart: Boolean = false)(callback: => T): Option[T] = {
Try({
val task = Executors.newSingleThreadExecutor().submit(new Callable[T]() {
def call(): T = {
callback
}
})
if(timeout<0){
task.get()
}else {
task.get(timeout, TimeUnit.SECONDS)
}
}) match {
case Success(v) => {
appiumExecResults.append("success")
Some(v)
}
case Failure(e) => {
e match {
case e: TimeoutException => {
log.error(s"${timeout} seconds timeout") //----这里!这里!
appiumExecResults.append("timeout")
}
case _ => {
我输入 java -jar appcrawler-2.1.3.jar -a XXXX.apk 跑,后面就出现如上图,这是什么原因,在哪个地方修改。
我也遇到了 appcrawler 不超时 不结束,commad+c 也不能结束的,也未输出日志文件;
楼主解决了吗
我这也出现这个问题,后面在 yml 配置文件中,capability 节点下面加个 automationName: "UiAutomator2" 就可以了
有没有解决这个问题呀?我也遇到了不知怎么解决,楼上的说 yml 文件修改,不知怎么操作。
我也遇到了这个问题,但是我加了 automationName: "UiAutomator2"之后,get page source 这一步可以成功,但是接下来定位元素定位不到了
iOS 基本找不到元素呀,求问为啥?