appuim-java,同时连接多台机器,启动微信

【appuim-java,同时连接多台机器,启动微信】我自横刀向天笑,去留肝胆两昆仑。这篇文章主要讲述appuim-java,同时连接多台机器,启动微信相关的知识,希望能为你提供帮助。
  1.配置appium信息
第一台机

appuim-java,同时连接多台机器,启动微信

文章图片

 
appuim-java,同时连接多台机器,启动微信

文章图片

第二台机类似,连接端口和监听端口不能重复
2.appium连接手机,微信中打开debugx5.qq.com,信息-》TBS settings-》是否打开TBS内核Insperector调试功能
3.代码
方法
public DesiredCapabilities get_capabilities(int i){ //配置appuim信息 DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); //定义使用的浏览器Chrome,Safari switch (i) { case 1: capabilities.setCapability("platformName", "android"); //手机操作系统 capabilities.setCapability("deviceName", "4d00be1d37cd4033"); //手机类型 capabilities.setCapability("udid", "4d00be1d37cd4033"); //连接手机的唯一标识 capabilities.setCapability("platformVersion", "5.0.1"); //操作系统版本 break; case 2: capabilities.setCapability("platformName", "Android"); capabilities.setCapability("deviceName","EJL4C16C15005850"); capabilities.setCapability("udid", "EJL4C16C15005850"); capabilities.setCapability("platformVersion", "6.0"); break; default: break; } capabilities.setCapability("appPackage", "com.tencent.mm"); //app包名 capabilities.setCapability("appActivity", ".ui.LauncherUI"); //要启动的Android Activity名 capabilities.setCapability("noReset", true); //不要在会话前重置应用状态 capabilities.setCapability("fullReset", false); //Android是否删除应用,ios是否删除整个模拟器目录 capabilities.setCapability("sessionOverride", true); //输入配置 capabilities.setCapability("unicodeKeyboard", true); //是否启动Unicode输入法 capabilities.setCapability("resetKeyboard", false); //结束后是否切换回默认输入法 //H5驱动关键,不配置webview会被识别成com.tencent.mm的webview,不是com.tencent.mm:tools的 ChromeOptions op= new ChromeOptions(); op.setExperimentalOption("androidProcess", "com.tencent.mm:tools"); capabilities.setCapability(ChromeOptions.CAPABILITY, op); return capabilities; }

使用例子
private AndroidDriver AndroidDriver; private AndroidDriver AndroidDriver2; private Start_Driver Start_Driver= new Start_Driver(); @Before public void setUp() throws Exception {try { AndroidDriver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), Start_Driver.get_capabilities(1)); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }try { AndroidDriver2 = new AndroidDriver(new URL("http://127.0.0.1:4728/wd/hub"), Start_Driver.get_capabilities(2)); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

 

    推荐阅读