public static void getText(BySelector by, String text) {
sleep(2000);
mDevice.wait(Until.findObject(by), waitTime);
UiObject2 x = mDevice.findObject(by);
if (x != null) {
if (x.getText().equals(text)) {
contentPass("检查元素上的文字符合预期", "getText", by.toString(), "");
} else {
contentFail("检查元素上的文字符合预期", "getText", by.toString(), "");
Log.e(TAG, "预期:" + text + "\t实际:" + x.getText());
}
} else {
Log.e(TAG, "没找到: " + by.toString());
}
}