如何在 Android Espresso 自定义匹配器中使用 view.getId() 获取视图的 ID(字符串)?
How to get id (string) of view using view.getId() inside Android Espresso custom matcher?
我需要在自定义 Espresso 匹配器中获取视图的 ID(字符串)。我需要在日志中写入类似 with id: com.domain:id/et_name
的内容。
我尝试使用:Resources.getSystem().getResourceName(textView.getId());
,但它 returns null
。
在 espresso 匹配器中获取 id 的方法是什么?
这是获取视图 ID(字符串)的方法:textView.getResources().getResourceName(textView.getId());
,但看起来 espresso 不允许写入日志 -:(
我需要在自定义 Espresso 匹配器中获取视图的 ID(字符串)。我需要在日志中写入类似 with id: com.domain:id/et_name
的内容。
我尝试使用:Resources.getSystem().getResourceName(textView.getId());
,但它 returns null
。
在 espresso 匹配器中获取 id 的方法是什么?
这是获取视图 ID(字符串)的方法:textView.getResources().getResourceName(textView.getId());
,但看起来 espresso 不允许写入日志 -:(