package com.lyy.appium;
import java.net.URL;
import java.sql.DriverManager;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
public class AppiumTestBase extends LogUtil{
public AppiumDriver driver;
@BeforeTest
public void setup() throws Exception{
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.BROWSER_NAME, "");
cap.setCapability("platformName", "iOS");
cap.setCapability("deviceName", "iPhone 6s Plus");
cap.setCapability("platformVersion", "11.4.1");
cap.setCapability("noReset", "True");
cap.setCapability("fullReset", "False");
cap.setCapability("bundleId", "com.eisoo.anyshare");
cap.setCapability("sessionOverride", true);
cap.setCapability("newCommandTimeout", "200000");
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
}
}
启动的脚本如上所示,但每次执行脚本都打开的是虚拟机检测不到真机,我的 app-inspector 已经配置好了,可以成功启动