Android模拟器 - 无法截屏 - 不支持的协议:2

问题描述 投票:2回答:1

我正在使用Xamarin.UITest在Android模拟器上运行测试。测试成功运行,但所需文件夹中没有屏幕截图文件。日志文件中有一条错误消息:

12:12:03 E/Screenshot: Unsupported protocol: 2
Could not take screenshot
java.lang.NullPointerException
    at sh.calaba.screenshot.ScreenshotTaker.saveImage(Unknown Source)
    at sh.calaba.screenshot.ScreenshotTaker.takeScreenshot(Unknown Source)
    at sh.calaba.screenshot.ScreenshotTaker.main(Unknown Source)

04-07-2018 12:12:03.738 +03:00 - 9038 - Took screenshot. { Path: "C:\Source\Repos\MyApp\MyApp.UITests\bin\Release\screenshot-1.png", Title: "Welcome screen." }

初始化:

return ConfigureApp
    .Android
    .EnableLocalScreenshots()
    .ApkFile("../../../MyApp.Android/bin/Release/com.myapp.MyApp-Signed.apk")
    .StartApp();

测试:

AppResult[] results = app.WaitForElement(c => c.Marked("mainPage"));
app.Screenshot("Welcome screen.");
Assert.IsTrue(results.Any());
android xamarin android-emulator xamarin.uitest
1个回答
0
投票

这个问题已经解决了最新的Calabash for Android 8.1

参考:https://github.com/calabash/calabash-android/pull/866

© www.soinside.com 2019 - 2024. All rights reserved.