[英]Android : How to click on a disabled button to enable it
I am using Robotium for android UI automation. 我将Robotium用于Android UI自动化。 I am stuck at a point where i am trying to click on a button in the application that is initially disabled.
我被困在试图单击最初禁用的应用程序中的按钮上的位置。 Robotium fails to find the text or button.
Robotium无法找到文本或按钮。 I am trying the following code.
我正在尝试以下代码。
if (solo.searchText(".*android.*"))
{
solo.clickOnText(".*android.*");
}
else solo.goBack();
Clicking on the button will enable it. 单击该按钮将启用它。 Thanks in advance.
提前致谢。
Try this : 尝试这个 :
for(View v: solo.getViews()) {
if(v instanceof Button) {
if( ((Button)v).getText().toString().equalsIgnoreCase("some text") )
{
solo.clickOnView(v);
solo.sleep(3000);
break;
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.