Back to project page verival-uiautomator.
The source code is released under:
GNU General Public License
If you think the Android project verival-uiautomator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package br.unb.vvs.uiautomator; /* ww w . j a va 2 s . c o m*/ //Device used to implement this test: Samsung Galaxy S3- Android version 4.3, CyanogenMod //Import the uiautomator libraries import com.android.uiautomator.core.UiObject; import com.android.uiautomator.core.UiObjectNotFoundException; import com.android.uiautomator.core.UiSelector; import com.android.uiautomator.testrunner.UiAutomatorTestCase; public class Test04_callEmergencyNumbers extends UiAutomatorTestCase { public void setUp() { String output = "\nTest " + this.getName().substring(4) + "() "; System.out.println(output); // Simulate a short press on the HOME button. // getUiDevice().pressHome(); } public void callEmergencyNumbersTest() throws UiObjectNotFoundException { UiObject emergencyCall = new UiObject( new UiSelector().text("CHAMADA DE EMERGNCIA")); emergencyCall.click(); UiObject zero = new UiObject(new UiSelector().description("zero")); UiObject one = new UiObject(new UiSelector().description("um")); UiObject two = new UiObject(new UiSelector().description("dois")); UiObject nine = new UiObject(new UiSelector().description("nove")); // Calling the police one.click(); nine.click(); zero.click(); UiObject call = new UiObject(new UiSelector().description("discar")); call.click(); // Finishing the call UiObject endCall = new UiObject( new UiSelector().description("Finalizar")); endCall.click(); // Simulate a short press on the HOME button. // getUiDevice().pressHome(); emergencyCall.click(); // Calling the fireman one.click(); nine.click(); two.click(); call.click(); // Finishing the call endCall.click(); } }