当前位置: 首页>>代码示例>>Java>>正文


Java UiObject.getText方法代码示例

本文整理汇总了Java中com.android.uiautomator.core.UiObject.getText方法的典型用法代码示例。如果您正苦于以下问题:Java UiObject.getText方法的具体用法?Java UiObject.getText怎么用?Java UiObject.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.uiautomator.core.UiObject的用法示例。


在下文中一共展示了UiObject.getText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
@Override
public Object handle(Object[] args) throws UiObjectNotFoundException {
    UiElementPropertiesContainer propertiesContainer = (UiElementPropertiesContainer) args[0];

    UiSelector selector = UiSelectorParser.convertSelector(propertiesContainer);

    UiObject field = new UiObject(selector);

    field.clearTextField();

    for (int i = 0; i < ACTION_TIMEOUT_SECONDS / (ACTION_TIMEOUT_STEP / 1000); i++) {
        String text = field.getText();
        if (!text.isEmpty()) {
            try {
                Thread.sleep(ACTION_TIMEOUT_STEP);
            } catch (InterruptedException e) {
                // Nothing to do here
            }
        } else {
            break;
        }
    }

    return UIAutomatorRequest.VOID_RESPONSE;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:26,代码来源:TextFieldEraser.java

示例2: chat

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
protected void chat() throws UiObjectNotFoundException {
	// Select First conversation
	UiSelector firstEl = new UiSelector()
			.className("android.widget.ListView").index(3)
			.childSelector(new UiSelector().index(0));
	UiObject conversation = new UiObject(firstEl);
	conversation.clickAndWaitForNewWindow();

	// Reads Text
	UiObject text = new UiObject(find("ListView-2.LinearLayout-2.TextView-0").instance(0));
	String response;
	if (text.exists()) {
		String userInput = text.getText();
		// Get response from the server
		response = getResponseFor(userInput.toString());
	} else {
		response = "What?";
	}

	// Write response back
	UiObject textBox = new UiObject(find("EditText-0"));
	UiObject submitButton = new UiObject(find("LinearLayout-5.ImageView-3"));
	textBox.setText(response);
	submitButton.click();

	// Delete conversation
	UiObject conversarionManager = new UiObject(new UiSelector().className(
			"android.widget.ImageView").instance(2));
	conversarionManager.clickAndWaitForNewWindow();
	UiObject closeButton = new UiObject(find("TextView-3"));
	closeButton.clickAndWaitForNewWindow();
	UiObject confirmCloseButton = new UiObject(find("Button-1"));
	confirmCloseButton.click();
}
 
开发者ID:chesterbr,项目名称:vicky,代码行数:35,代码来源:LaunchSettings.java

示例3: getCurrentMeridiem

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
public static String getCurrentMeridiem() throws UiObjectNotFoundException {
    UiObject meridiem = new UiObject(new UiSelector().className(
            android.widget.Button.class.getName()).resourceId(MERIDIEM_ID));

    return meridiem.getText();
}
 
开发者ID:SeaDroids,项目名称:CIWorkshopProjects,代码行数:7,代码来源:SamsungGalaxyS5sdk19TimePickerHelper.java


注:本文中的com.android.uiautomator.core.UiObject.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。