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


Java UiObject.setText方法代码示例

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


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

示例1: testDemo

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
public void testDemo() throws UiObjectNotFoundException {

        // Press on the HOME button.
        getUiDevice().pressHome();

        // Launch the "Google" apps via the All Apps screen.
        UiObject allAppsButton = new UiObject(new UiSelector().description("Apps"));
        allAppsButton.clickAndWaitForNewWindow();
        UiObject appsTab = new UiObject(new UiSelector().text("Apps"));
        appsTab.click();
        UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));
        appViews.setAsHorizontalList();
        UiObject testApp = appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()),
                "Google");
        testApp.clickAndWaitForNewWindow();

        // Get the google search text box
        UiObject searchBox = new UiObject(
                new UiSelector().className("com.google.android.search.shared.ui.SimpleSearchText"));

        // do Japanese Input!
        searchBox.setText(Utf7ImeHelper.e("こんにちは!UiAutomatorで入力しています。"));
    }
 
开发者ID:Xiangxingqian,项目名称:WeiXinGroupSend,代码行数:24,代码来源:UiAutomatorInputTest.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: run

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
    // TODO use both content-description and text
    //UiObject uiObject = new UiObject(new UiSelector().descriptionContains(description));
    UiObject uiObject = new UiObject(new UiSelector().textContains(description));
    try {
        uiObject.setText(value);
    } catch (UiObjectNotFoundException e) {
        e.printStackTrace();
        return e.getMessage();
    }
    return null;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:14,代码来源:InputAction.java


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