Appium Android?????TestNG???????????
???????????? ???????[ 2014/12/8 9:47:31 ] ??????????????? ?????????? ·??
?????????????*?1
package com.testerhome;
import io.appium.java_client.android.AndroidDriver;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
public class Suite1 {
public String port;
public String udid;
private AndroidDriver driver;
@Test
public void switches() throws InterruptedException {
WebElement sound = driver.findElementByAndroidUIAutomator("new UiSelector().text("Sound")");
sound.click();
System.out.println("checked");
Thread.sleep(2000);
System.out.println(Thread.currentThread());
}
@BeforeSuite
@Parameters({ "port"?? "udid" })
public void beforeSuite(String port?? String udid) {
this.port = port;
this.udid = udid;
}
@BeforeClass
public void beforeClass() throws MalformedURLException{
System.out.println(port + udid);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName"??"device1");
capabilities.setCapability("automationName"??"Appium");
capabilities.setCapability("platformVersion"?? "4.4");
capabilities.setCapability("udid"?? udid);
capabilities.setCapability("appPackage"?? "com.android.settings");
capabilities.setCapability("appActivity"?? ".Settings");
driver = new AndroidDriver(new URL("http://127.0.0.1:" + port + "/wd/hub")?? capabilities);
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11