您的位置:首页 > 其它

第一个测试例子 发短信sendMessage

2015-05-16 15:43 295 查看
package com.sprd.test.uiautomator.message;
import com.android.uiautomator.core.UiDevice;
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 MessageTest extends UiAutomatorTestCase{

public void test_Send() throws UiObjectNotFoundException {

//

UiDevice uidevice = getUiDevice();
uidevice.pressHome();

UiObject message = new UiObject (new UiSelector().text("信息"));
message.clickAndWaitForNewWindow();
UiObject newmessage = new UiObject (new UiSelector().resourceId("com.android.mms:id/action_compose_new"));
newmessage.clickAndWaitForNewWindow();
UiObject messageto = new UiObject (new UiSelector().text("收件人"));
messageto.clickAndWaitForNewWindow();
//
String phoneno = "13821568572";
messageto.setText(phoneno);
UiObject typemessage = new UiObject (new UiSelector().text("键入信息"));
typemessage.clickAndWaitForNewWindow();
String txt="message sending >>>>";
typemessage.setText(txt);
UiObject sendmessage = new UiObject (new UiSelector().resourceId("com.android.mms:id/send_button_sms"));
sendmessage.clickAndWaitForNewWindow();
UiObject chooseformat = new UiObject (new UiSelector().text("中国移动 01"));
chooseformat.click();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: