我想使用这个功能: https://developer.android.com/reference/androidx/test/uiautomator/BySelector#depth(int,int) 但是
BySelector
有包私有构造函数,所以我无法实例化它。相反,医生说:
客户端不应直接实例化此类。使用By工厂 改为上课。
但是
By
类只有这个方法和一个参数:
https://developer.android.com/reference/androidx/test/uiautomator/By#depth(int)
我注定要使用一些丑陋的循环来检查所有深度还是我错过了一些东西?
你必须使用
By
工厂:
import androidx.test.uiautomator.By
device.findObjects(By.text("some text"))