appium-java中if-elseif学习
/** 我的页面通过名字跳转到二维码点击分享好友
* @throws Exception
* 1、点击我的
* 2、点击我的名字
* 3、点击二维码
* 4、点击保存
* */
public static void PersonalSettingsPagesShareFriends() throws Exception
{
Thread.sleep(5000);
driver.findElement(GetByLocator.getLocator("MyInfo")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(GetByLocator.getLocator("PrivateCardName")).click();
//#二维码:
driver.findElement(GetByLocator.getLocator("PrivateCardNamerq")).click();
//分享
driver.findElement(GetByLocator.getLocator("QrCodeShare")).click();
/**
* 截图*/
TJTAppiumTest.ScreenshotAsDate("QrCodeShare");
List My_FriendsList = driver.findElements(GetByLocator.getLocator("My_Friends"));
for(AndroidElement ls:My_FriendsList)
{
String My_FriendsListName = ls.getAttribute("text");
System.out.println("My_FriendsListName:" + My_FriendsListName);
if(My_FriendsListName.equals("好友"))
{
driver.findElement(GetByLocator.getLocator("My_Friends")).click();
}else if(My_FriendsListName.equals("小组")){
} else if(My_FriendsListName.equals("微信好友")){
} else if(My_FriendsListName.equals("微博")){
}else if(My_FriendsListName.equals("QQ好友")){
}else if(My_FriendsListName.equals("QQ空间")){
}else if(My_FriendsListName.equals("信息")){
}else {
System.out.println("没有找到!!");
}
}
//driver.findElement(GetByLocator.getLocator("My_Friends")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(GetByLocator.getLocator("friend_share_contact")).click();
driver.findElement(GetByLocator.getLocator("Friends_share_search")).sendKeys("美丽的开始");//搜索好友名称
driver.findElement(GetByLocator.getLocator("SelectTheSearchResults")).click();
driver.findElement(GetByLocator.getLocator("Share_send")).click();
TJTAppiumTest.ScreenshotAsDate("Share_send");
driver.pressKeyCode(AndroidKeyCode.BACK);
driver.pressKeyCode(AndroidKeyCode.BACK);
driver.pressKeyCode(AndroidKeyCode.BACK);
}
分享文章:appium-java中if-elseif学习
链接URL:http://myzitong.com/article/jphcoj.html