繁体   English   中英

Robotium:如何自动在RecyclerView行中单击按钮?

[英]Robotium: How to automate button click in the RecyclerView row?

我正在使用Robotium (版本:5.5.3)。 我在RecyclerView的行中有一个按钮。 我想自动在特定行上单击该按钮。

solo.clickInRecyclerView(index);  only automates the clicking of that whole row.

我怎样才能做到这一点?

getActivity().getFragmentManager().getFragmentAtPosition(count-1)

这将为您提供最高(当前)的片段。 然后将其转换为所需的fragmnet。 例如。

MyFrag myCurrentFrag = (MyFrag) ....

然后使用它,获取适配器或recylerview。 获得所需的recylerview实例后,请使用

RelativeLayout myRel = (RelativeLayout) getchildAt();
Button btn = (button) myRel.findViewById();
btn.performClick();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM