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


Java UiObject.getChild方法代码示例

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


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

示例1: testVideoInfoTypeTitle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the video info screen contains the type TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testVideoInfoTypeTitle() throws RemoteException,
		UiObjectNotFoundException {
	openVideoInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(1));
	UiObject typeTitle = parent.getChild(new UiSelector().index(0));

	assertTrue("Type title view doesn't exist", typeTitle.exists());
	assertTrue("Type title view isn't enabled", typeTitle.isEnabled());
	assertEquals("Type title view isn't a TextView",
			"android.widget.TextView", typeTitle.getClassName());
	assertEquals("Type title is incorrect string", "Type:",
			typeTitle.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:23,代码来源:VideoInfoUiTest.java

示例2: testHomeItemClick

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Test whether the drawer opens the thumbgrid fragment when the first list
 * item (home item) is clicked
 * 
 * @throws UiObjectNotFoundException
 * @throws RemoteException
 */
public void testHomeItemClick() throws UiObjectNotFoundException,
		RemoteException {
	openNavigationDrawer();
	UiObject navDrawer = new UiObject(
			new UiSelector().description("navigation_drawer"));

	UiObject homeItem = navDrawer.getChild(new UiSelector().text("Home"));
	assertTrue("Navigation drawer doesn't exist", navDrawer.exists());
	assertTrue("Home item click failed", homeItem.click());

	// check whether nav drawer is closed
	assertFalse("Navigation drawer is still open after clicking home item",
			navDrawer.exists());

	// check if the app title is changed
	UiObject upButton = new UiObject(
			new UiSelector().descriptionContains("navigation drawer"));
	UiObject title = upButton.getChild(new UiSelector()
			.className("android.widget.TextView"));

	assertEquals(
			"App title not correctly changed after clicking home item",
			"Home", title.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:32,代码来源:NavigationDrawerUiTest.java

示例3: testVideoInfoLeechersTitle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the video info screen contains the leechers TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testVideoInfoLeechersTitle() throws RemoteException,
		UiObjectNotFoundException {
	openVideoInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(1));
	UiObject leechersTitle = parent.getChild(new UiSelector().index(3));

	assertTrue("Leechers title view doesn't exist", leechersTitle.exists());
	assertTrue("Leechers title view isn't enabled",
			leechersTitle.isEnabled());
	assertEquals("Leechers title view isn't a TextView",
			"android.widget.TextView", leechersTitle.getClassName());
	assertEquals("Leechers title is incorrect string", "Leechers:",
			leechersTitle.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:24,代码来源:VideoInfoUiTest.java

示例4: testVideoInfoType

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the video info screen contains the type info TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testVideoInfoType() throws RemoteException,
		UiObjectNotFoundException {
	openVideoInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(2));
	UiObject type = parent.getChild(new UiSelector().index(0));

	assertTrue("Type view doesn't exist", type.exists());
	assertTrue("Type view isn't enabled", type.isEnabled());
	assertEquals("Type view isn't a TextView", "android.widget.TextView",
			type.getClassName());
	assertFalse("Type is empty string", type.getText().equals(""));
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:22,代码来源:VideoInfoUiTest.java

示例5: testListItemStatus

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the first item contains an existing and enabled status
 * TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testListItemStatus() throws RemoteException,
		UiObjectNotFoundException {
	openDownloadList();

	UiCollection list = new UiCollection(
			new UiSelector().className("android.widget.ListView"));
	UiObject firstItem = list.getChild(new UiSelector().index(0));
	UiObject status = firstItem.getChild(new UiSelector().index(1));

	assertTrue("Status doesn't exist", status.exists());
	assertTrue("Status isn't enabled", status.isEnabled());
	assertEquals("Status isn't a TextView", "android.widget.TextView",
			status.getClassName());
	assertFalse("Status is empty string", status.getText().equals(""));
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:23,代码来源:DownloadListUiTest.java

示例6: testVideoInfoSeedersTitle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the video info screen contains the seeders TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testVideoInfoSeedersTitle() throws RemoteException,
		UiObjectNotFoundException {
	openVideoInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(1));
	UiObject seedersTitle = parent.getChild(new UiSelector().index(2));

	assertTrue("Seeders title view doesn't exist", seedersTitle.exists());
	assertTrue("Seeders title view isn't enabled", seedersTitle.isEnabled());
	assertEquals("Seeders title view isn't a TextView",
			"android.widget.TextView", seedersTitle.getClassName());
	assertEquals("Seeders title is incorrect string", "Seeders:",
			seedersTitle.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:23,代码来源:VideoInfoUiTest.java

示例7: testVideoInfoFilesize

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the video info screen contains the filesize info TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testVideoInfoFilesize() throws RemoteException,
		UiObjectNotFoundException {
	openVideoInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(2));
	UiObject filesize = parent.getChild(new UiSelector().index(1));

	assertTrue("Filesize view doesn't exist", filesize.exists());
	assertTrue("Filesize view isn't enabled", filesize.isEnabled());
	assertEquals("Filesize view isn't a TextView",
			"android.widget.TextView", filesize.getClassName());
	assertFalse("Filesize is empty string", filesize.getText().equals(""));
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:22,代码来源:VideoInfoUiTest.java

示例8: openDownloadList

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Launches the app, opens the navigation drawer and clicks the downloads
 * item to load the downloads list
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
private void openDownloadList() throws RemoteException,
		UiObjectNotFoundException {
	startTSAP();

	UiObject navDrawer = new UiObject(
			new UiSelector().description("navigation_drawer"));
	if (!navDrawer.exists()) {
		UiObject upButton = new UiObject(
				new UiSelector().description("Navigate up"));
		upButton.click();
	}

	UiObject downloadsItem = navDrawer.getChild(new UiSelector()
			.text("Downloads"));
	downloadsItem.click();
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:24,代码来源:DownloadListUiTest.java

示例9: testDownloadInfoETATitle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the download info screen contains the ETA TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testDownloadInfoETATitle() throws RemoteException,
		UiObjectNotFoundException {
	openDownloadInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(3));
	UiObject etaTitle = parent.getChild(new UiSelector().index(1));

	assertTrue("ETA title view doesn't exist", etaTitle.exists());
	assertTrue("ETA title view isn't enabled", etaTitle.isEnabled());
	assertEquals("ETA title view isn't a TextView",
			"android.widget.TextView", etaTitle.getClassName());
	assertEquals("ETA title is incorrect string", "ETA:",
			etaTitle.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:23,代码来源:DownloadInfoUiTest.java

示例10: testGridItemThumbnail

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the first item contains an existing and enabled thumbnail
 * ImageView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testGridItemThumbnail() throws RemoteException,
		UiObjectNotFoundException {
	openThumbGrid();

	UiCollection grid = new UiCollection(
			new UiSelector().className("android.widget.GridView"));
	UiObject firstItem = grid.getChild(new UiSelector().index(0));
	UiObject thumbnail = firstItem.getChild(new UiSelector()
			.description("Torrent thumbnail"));

	assertTrue("Thumbnail view doesn't exist", thumbnail.exists());
	assertTrue("Thumbnail view isn't enabled", thumbnail.isEnabled());
	assertEquals("Thumbnail view isn't an ImageView",
			"android.widget.ImageView", thumbnail.getClassName());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:23,代码来源:ThumbGridUiTest.java

示例11: testDownloadInfoSpeedUpTitle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the download info screen contains the speed up TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testDownloadInfoSpeedUpTitle() throws RemoteException,
		UiObjectNotFoundException {
	openDownloadInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(0));
	UiObject speedUpTitle = parent.getChild(new UiSelector().index(2));

	assertTrue("Speed up title view doesn't exist", speedUpTitle.exists());
	assertTrue("Speed up title view isn't enabled",
			speedUpTitle.isEnabled());
	assertEquals("Speed up title view isn't a TextView",
			"android.widget.TextView", speedUpTitle.getClassName());
	assertEquals("Speed up title is incorrect string", "Speed up:",
			speedUpTitle.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:24,代码来源:DownloadInfoUiTest.java

示例12: testDownloadInfoAvailabilityTitle

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the download info screen contains the availability TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testDownloadInfoAvailabilityTitle() throws RemoteException,
		UiObjectNotFoundException {
	openDownloadInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(0));
	UiObject availabilityTitle = parent.getChild(new UiSelector().index(3));

	assertTrue("Availability title view doesn't exist",
			availabilityTitle.exists());
	assertTrue("Availability title view isn't enabled",
			availabilityTitle.isEnabled());
	assertEquals("Availability title view isn't a TextView",
			"android.widget.TextView", availabilityTitle.getClassName());
	assertEquals("Availability title is incorrect string", "Availability",
			availabilityTitle.getText());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:25,代码来源:DownloadInfoUiTest.java

示例13: testVideoInfoSeeders

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the video info screen contains the seeders info TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testVideoInfoSeeders() throws RemoteException,
		UiObjectNotFoundException {
	openVideoInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(2));
	UiObject seeders = parent.getChild(new UiSelector().index(2));

	assertTrue("Seeders view doesn't exist", seeders.exists());
	assertTrue("Seeders view isn't enabled", seeders.isEnabled());
	assertEquals("Seeders view isn't a TextView",
			"android.widget.TextView", seeders.getClassName());
	assertFalse("Seeders is empty string", seeders.getText().equals(""));
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:22,代码来源:VideoInfoUiTest.java

示例14: testDownloadInfoSpeedDown

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Tests whether the download info screen contains the speed down info
 * TextView
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
public void testDownloadInfoSpeedDown() throws RemoteException,
		UiObjectNotFoundException {
	openDownloadInfoScreen();

	UiObject infoView = new UiObject(
			new UiSelector().className("android.widget.RelativeLayout"));
	UiObject parent = infoView.getChild(new UiSelector().index(1));
	UiObject speedDown = parent.getChild(new UiSelector().index(1));

	assertTrue("Speed down view doesn't exist", speedDown.exists());
	assertTrue("Speed down view isn't enabled", speedDown.isEnabled());
	assertEquals("Speed down view isn't a TextView",
			"android.widget.TextView", speedDown.getClassName());
	assertFalse("Speed down is empty string", speedDown.getText()
			.equals(""));
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:24,代码来源:DownloadInfoUiTest.java

示例15: openVideoInfoScreen

import com.android.uiautomator.core.UiObject; //导入方法依赖的package包/类
/**
 * Launches the app, opens the navigation drawer and click the home item to
 * load the thumb grid and then clicks the first item
 * 
 * @throws RemoteException
 * @throws UiObjectNotFoundException
 */
protected void openVideoInfoScreen() throws RemoteException,
		UiObjectNotFoundException {
	startTSAP();

	UiObject navDrawer = new UiObject(
			new UiSelector().description("navigation_drawer"));
	if (!navDrawer.exists()) {
		UiObject upButton = new UiObject(
				new UiSelector().description("Navigate up"));
		upButton.click();
	}

	UiObject homeItem = navDrawer.getChild(new UiSelector().text("Home"));
	homeItem.click();

	UiCollection grid = new UiCollection(
			new UiSelector().className("android.widget.GridView"));
	UiObject firstItem = grid.getChild(new UiSelector().index(0));
	firstItem.click();
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:28,代码来源:VideoInfoUiTest.java


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