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


Java UiDevice.pressHome方法代码示例

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


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

示例1: openAppTest

import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
@Test
public void openAppTest() throws Exception {
    UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
    mDevice.pressHome();
    // Bring up the default launcher by searching for a UI component
    // that matches the content description for the launcher button.
    UiObject allAppsButton = mDevice
            .findObject(new UiSelector().description("Apps"));

    // Perform a click on the button to load the launcher.
    allAppsButton.clickAndWaitForNewWindow();
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.wbrawner.simplemarkdown", appContext.getPackageName());
    UiScrollable appView = new UiScrollable(new UiSelector().scrollable(true));
    UiSelector simpleMarkdownSelector = new UiSelector().text("Simple Markdown");
    appView.scrollIntoView(simpleMarkdownSelector);
    mDevice.findObject(simpleMarkdownSelector).clickAndWaitForNewWindow();
}
 
开发者ID:wbrawner,项目名称:SimpleMarkdown,代码行数:21,代码来源:MainActivityTests.java

示例2: launchClickHome

import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
@Override
protected void launchClickHome() {
    Log.i(runner.chimpTag("[email protected]"), "ClickHome");

    // Espresso.onView(isRoot()).perform( new ChimpStagingAction() );

    UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
    mDevice.pressHome();

    // Espresso.onView(isRoot()).perform(pressKey(KeyEvent.KEYCODE_HOME));
    // kickBackExperiment();
}
 
开发者ID:cuplv,项目名称:ChimpCheck,代码行数:13,代码来源:EspressoChimpDriver.java

示例3: start

import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
/**
 * <i>The tests have to start from the screen home</i>
 */
@BeforeClass
public static void start(){
    l("AbstractTest","@BeforeClass start");
    UiDevice d = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    d.pressHome();
}
 
开发者ID:pylapp,项目名称:SmoothClicker,代码行数:10,代码来源:AbstractTest.java

示例4: end

import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
/**
 * <i>The device should be at its initial state when all tests are done</i>
 */
@AfterClass
public static void end(){
    l("AbstractTest","@AfterClass end");
    UiDevice d = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    d.pressHome();
}
 
开发者ID:pylapp,项目名称:SmoothClicker,代码行数:10,代码来源:AbstractTest.java


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