如何使用 Kaspresso/Kakao/UI Automator 从下载文件夹中选取文件?找不到任何相关信息。
我找到了解决方案。卡斯派索:
@Test
fun sendReceiveFile() {
ChatMainScreen {
addAttachmentBtn {
isVisible()
click()
}
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
UiScrollable(UiSelector().scrollable(true).instance(0)).scrollIntoView(
UiSelector().textContains("test_pdf2").instance(0)
) // we need to scroll to this element if not visible
val okButton: UiObject2? = device.findObject(
By.textContains("test_pdf2")
)
device.performActionAndWait({ okButton?.click() }, Until.newWindow(), 4000)
sendMessageBtn {
isVisible()
click()
}
chatItemsRecyclerView {
hasDescendant { containsText("test_pdf1") }
}
}
}